Part Number Hot Search : 
R1500 M79C9 ST3FTP0 LSO2815D EM91410B CPD104R R05L12 LB1848
Product Description
Full Text Search
 

To Download UPD703111 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  v850e/me2 tm 32-bit single-chip microcontroller hardware preliminary user?s manual pd703111 printed in japan document no. u16031ej2v1ud00 (2nd edition) date published may 2003 n cp(k) ?
2 preliminar y user?s manual u16031ej2v1ud [memo]
3 preliminar y user?s manual u16031ej2v1ud notes for cmos devices 1 precaution against esd for semiconductors note: strong electric field, when exposed to a mos device, can cause destruction of the gate oxide and ultimately degrade the device operation. steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it once, when it has occurred. environmental control must be adequate. when it is dry, humidifier should be used. it is recommended to avoid using insulators that easily build static electricity. semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. all test and measurement tools including work bench and floor should be grounded. the operator should be grounded using wrist strap. semiconductor devices must not be touched with bare hands. similar precautions need to be taken for pw boards with semiconductor devices on it. 2 handling of unused input pins for cmos note: no connection for cmos device inputs can be cause of malfunction. if no connection is provided to the input pins, it is possible that an internal input level may be generated due to noise, etc., hence causing malfunction. cmos devices behave differently than bipolar or nmos devices. input levels of cmos devices must be fixed high or low by using a pull-up or pull-down circuitry. each unused pin should be connected to v dd or gnd with a resistor, if it is considered to have a possibility of being an output pin. all handling related to the unused pins must be judged device by device and related specifications governing the devices. 3 status before initialization of mos devices note: power-on does not necessarily define initial status of mos device. production process of mos does not define the initial operation status of the device. immediately after the power source is turned on, the devices with reset function have not yet been initialized. hence, power-on does not guarantee out-pin levels, i/o settings or contents of registers. device is not initialized until the reset signal is received. reset operation must be executed immediately after power-on for devices having reset function. v850 series and v850e/me2 are trademarks of nec electronics corporation.
4 preliminar y user ? s manual u16031ej2v1ud the information contained in this document is being issued in advance of the production cycle for the product. the parameters for the product may change before final production or nec electronics corporation, at its own discretion, may withdraw the product prior to its production. not all products and/or types are available in every country. please check with an nec electronics sales representative for availability and additional information. no part of this document may be copied or reproduced in any form or by any means without the prior written consent of nec electronics. nec electronics assumes no responsibility for any errors that may appear in this document. nec electronics does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of nec electronics products listed in this document or any other liability arising from the use of such products. no license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of nec electronics or others. descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. the incorporation of these circuits, software and information in the design of a customer's equipment shall be done under the full responsibility of the customer. nec electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. while nec electronics endeavors to enhance the quality, reliability and safety of nec electronics products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. to minimize risks of damage to property or injury (including death) to persons arising from defects in nec electronics products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and anti-failure features. nec electronics products are classified into the following three quality grades: "standard", "special" and "specific". the "specific" quality grade applies only to nec electronics products developed based on a customer-designated "quality assurance program" for a specific application. the recommended applications of an nec electronics products depend on its quality grade, as indicated below. customers must check the quality grade of each nec electronics product before using it in a particular application. "standard": computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots. "special": transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support). "specific": aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. the quality grade of nec electronics products is "standard" unless otherwise expressly specified in nec electronics data sheets or data books, etc. if customers wish to use nec electronics products in applications not intended by nec electronics, they must contact an nec electronics sales representative in advance to determine nec electronics' willingness to support a given application. (note) (1) "nec electronics" as used in this statement means nec electronics corporation and also includes its majority-owned subsidiaries. (2) "nec electronics products" means any product developed or manufactured by or for nec electronics (as defined above). ? ? ? ? ? ? ? m5d 02. 11-1
5 preliminar y user ? s manual u16031ej2v1ud regional information ? device availability ? ordering information ? product release schedule ? availability of related technical literature ? development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, ac supply voltages, and so forth) ? network requirements in addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country. [global support] http://www.necel.com/en/support/support.html nec electronics america, inc. (u.s.) santa clara, california tel: 408-588-6000 800-366-9782 nec electronics hong kong ltd. hong kong tel: 2886-9318 nec electronics hong kong ltd. seoul branch seoul, korea tel: 02-558-3737 nec electronics shanghai, ltd. shanghai, p.r. china tel: 021-6841-1138 nec electronics taiwan ltd. taipei, taiwan tel: 02-2719-2377 nec electronics singapore pte. ltd. novena square, singapore tel: 6253-8311 j03.4 n ec electronics (europe) gmbh duesseldorf, germany tel: 0211-65 03 01  sucursal en espa ? a madrid, spain tel: 091-504 27 87 v lizy-villacoublay, france tel: 01-30-67 58 00  succursale fran ? aise  filiale italiana milano, italy tel: 02-66 75 41  branch the netherlands eindhoven, the netherlands tel: 040-244 58 45  tyskland filial taeby, sweden tel: 08-63 80 820  united kingdom branch milton keynes, uk tel: 01908-691-133 some information contained in this document may vary from country to country. before using any nec electronics product in your application, piease contact the nec electronics office in your country to obtain a list of authorized representatives and distributors. they will verify:
6 preliminar y user?s manual u16031ej2v1ud major revisions in this edition (1/4) page description throughout ? addition of the following product. pd703111gm-15-ueu ? change of the following register name. pfcal pfcall p.29 addition of execution time of 150 mhz products to minimum instruction execution time in 1.2 features p.45 addition of note in 2.1 (2) non-port pins p.48 addition of description in 2.3 (1) (b) (vii) uclk (usb clock) p.50 modification of description in 2.3 (3) (b) (ii) dmaak0, dmaak1 (dma acknowledge) p.52 modification of description in 2.3 (5) (b) (ii) dmaak2, dmaak3 (dma acknowledge) p.68 addition of execution time of 150 mhz products to minimum instruction execution time in 3.1 features p.70 modification of default value in 3.2.1 (2) program counter (pc) pp.86, 98 modification of description in 3.4.7 peripheral i/o registers p.111 change of table of vswc setting values in 3.4.9 system wait control register (vswc) p.115 modification of description in 4.2.1 pin status during internal instruction ram, internal data ram, and peripheral i/o access p.121 modification of description when btn1 and btn0 bits are set to 11 in 4.4.1 (1) bus cycle type configuration registers 0, 1 (bct0, bct1) p.122 modification of table of number of access clocks in 4.5.1 number of access clocks p.146 addition to cautions and modification of description in 4.5.6 (1) line buffer control registers 0, 1 (lbc0, lbc1) p.147 addition of remark in 4.5.6 (1) (a) speculative read function (read buffer function) pp.148, 149 modification of description, addition of note, and addition to cautions in 4.5.6 (1) (b) write buffer function p.155 addition to cautions in 4.7.1 (3) bus cycle period control register (bcp) p.161 modification of cautions in 4.9.1 (1) cache configuration register (bhc) p.170 addition of (5) in 4.10.3 cautions p.177 addition of timing and modification of notes in 4.11.6 (1) sdram (when read, latency = 2, no idle state insertion) p.178 addition of timing and modification of notes in 4.11.6 (2) sdram (when read, latency = 2, two idle states inserted, 32-bit bus width) p.179 addition of timing and modification of notes in 4.11.6 (3) sdram (when written) p.182 addition of 4.14 timing at which t0 state is not inserted pp.214 to 217 addition of timing and modification of notes in figure 5-9 sdram single read cycle pp.220 to 224 addition of timing and modification of notes in figure 5-10 sdram single write cycle pp.227, 228, 232 to 234 addition of timing and modification of notes in figure 5-11 sdram access timing p.236 modification of caution in 5.3.6 (1) sdram refresh control registers 1, 3, 4, 6 (rfs1, rfs3, rfs4, rfs6) p.238 modification of description in table 5-1 example of interval factor settings p.247 addition of internal instruction ram in block diagram in 6.2 configuration p.248 addition to cautions in 6.3.1 (1) dma source address registers 0h to 3h (dsa0h to dsa3h) p.250 addition to cautions in 6.3.2 (1) dma destination address registers 0h to 3h (dda0h to dda3h)
7 preliminar y user?s manual u16031ej2v1ud major revisions in this edition (2/4) page description p.252 addition to cautions in 6.3.3 dma transfer count registers 0 to 3 (dbc0 to dbc3) p.253 addition to cautions in 6.3.4 dma addressing control registers 0 to 3 (dadc0 to dadc3) pp.256, 257 addition to cautions and description in 6.3.5 dma channel control registers 0 to 3 (dchc0 to dchc3) p.259 addition to cautions and description in 6.3.6 dma terminal count output control register (dtoc) p.260 addition to cautions in 6.3.7 dma trigger factor registers 0 to 3 (dtfr0 to dtfr3) pp.264, 265 addition of 6.3.7 (1) dma request detection function p.266 addition of caution and note and modification of description in 6.3.8 dma interface control register (difc) p.276 addition of timing and modification of notes in figure 6-12 timing of 2-cycle dma transfer (sdram sram) p.278 addition of 6.5.1 (1) timing of dmarqn and dmaakn signals for 2-cycle transfer p.280 addition of 6.5.1 (2) dmaakn signal active width extension function p.282 addition of 6.5.1 (3) outline of 2-cycle transfer timing pp.289 to 291 modification of timing in figure 6-19 timing of dma flyby transfer (external i/o sdram) pp.298, 299 modification of timing in figure 6-23 timing of dma flyby transfer (sdram external i/o) pp.300, 301 modification of timing in figure 6-24 timing of dma flyby transfer (external i/o sdram) p.302 modification of description and addition to caution in table 6-5 relationship between transfer type and transfer object p.305 addition of description in 6.8 next address setting function p.307 addition of cautions in 6.9 dma transfer start factors p.312 modification of description in 6.13 times related to dma transfer p.314 modification of description in 6.15 (3) bus arbitration for cpu p.315 addition of 6.15 (7) read values of dsan and ddan registers p.363 modification of note in figure 7-14 pipeline operation at interrupt request acknowledgment (outline) p.365 modification of selection of sscg output by pllsel pin and mdl-selector table (modulation period) in 8.1 features pp.367, 368 addition to cautions and modification of description in 8.3.1 clock control register (ckc) p.370 modification of sample coding <2> for data setting sequence of clock source select register (cks) in 8.3.2 clock source select register (cks) pp.371, 372 modification of description in 8.3.3 sscg control register (sscgc) p.373 addition of caution in 8.3.4 usb clock control register (uckc) p.375 modification of oscillation stabilization time in 8.3.6 oscillation stabilization time select register (osts) p.376 addition to notes in table 8-1 operation status of each clock p.376 modification of description in table 8-2 frequency list p.377 addition of 8.5 operating clock provisions p.400 modification of oscillation stabilization time in table 8-11 counting time examples p.412 addition to caution in 9.1.5 (2) timer mode control registers c01 to c51 (tmcc01 to tmcc51) p.422 modification of figure 9-7 tmc1 compare operation example (set/reset output mode) p.459 addition of noise elimination width when f x = 150 mhz in table 9-6 relationship between ncw1n register set value and noise elimination width
8 preliminar y user?s manual u16031ej2v1ud major revisions in this edition (3/4) page description p.475 addition of 9.3.7 (6) overflow interrupt signal (intov1n) and underflow interrupt signal (intud1n) p.477 modification of transfer rate in 10.2.1 features p.479 modification of description in 10.2.2 (10) uartbn receive data register ap (ubnrxap), uartbn receive data register (ubnrx) (n = 0, 1) p.480 addition of description in 10.2.2 (12) uartbn transmit data register n (ubntx) (n = 0, 1) p.487 modification of caution in 10.2.3 (3) uartbn control register 2 (ubnctl2) (n = 0, 1) p.488 addition of description in 10.2.3 (4) uartbn transmit data register (ubntx) (n = 0, 1) p.489 modification of description in 10.2.3 (5) uartbn receive data register ap (ubnrxap), uartbn receive data register (ubnrx) (n = 0, 1) pp.491, 492 addition and modification of description in 10.2.3 (6) uartbn fifo control register 0 (ubnfic0) (n = 0, 1) p.493 modification of description in 10.2.3 (7) uartbn fifo control register 1 (ubnfic1) (n = 0, 1) p.501 addition of description in 10.2.4 (5) (b) fifo mode p.503 addition of description in 10.2.5 (2) pending mode/pointer mode p.503 addition of note in 10.2.5 (2) (a) (i) during transmission (writing to transmit fifon) p.504 addition of note in 10.2.5 (2) (a) (ii) during reception (reading from receive fifon) p.512 addition of description in 10.2.6 (4) (c) (ii) reception timeout interrupt (ubtiton) (in fifo mode only) p.518 addition of value when f x = 150 mhz in table 10-4 baud rate generator setting data p.522 addition of 10.2.8 control flow p.535 modification of description in figure 10-22 block diagram of clocked serial interfaces 30 and 31 p.536 modification of description of caution 2 in 10.3.3 (1) clocked serial interface mode registers 30, 31 (csim30, csim31) p.540 modification of description in 10.3.3 (2) clocked serial interface clock select registers 30, 31 (csic30, csic31) p.541 addition of description in 10.3.3 (3) receive data buffer registers 30, 31 (sirb30, sirb31) p.542 addition of description in 10.3.3 (4) transmit data csi buffer registers 30, 31 (sfdb30, sfdb31) p.544 modification of description in 10.3.3 (5) csibuf status registers 30, 31 (sfa30, sfa31) p.549 modification of example in caution 2 in 10.3.4 (2) baud rate p.553 modification of description in figure 10-25 transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: msb first (dirn bit = 0 in csim3n register) p.555 modification of description in figure 10-26 transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: lsb first (dirn bit = 1 in csim3n register) p.559 deletion of description of 10.3.5 (7) slave mode p.559 modification of figure 10-30 slave mode (ckpn and dapn bits = 00 in csic3n register, ccln3 to ccln0 bits = 1000 in csil3n register (transfer data length: 8 bits)) p.563 modification of description in figure 10-32 continuous mode p.564 modification of description in 10.3.5 (11) transmission mode p.564 addition of description in 10.3.5 (12) reception mode p.567 deletion of description in 10.3.5 (16) (a) sckn pin p.567 modification of description in table 10-8 default output level of sckn pin pp.568 to 573 modification of description of (1) to (12) in 10.3.6 usage p.575 addition of caution in 11.1 overview
9 preliminar y user?s manual u16031ej2v1ud major revisions in this edition (4/4) page description p.578 addition of items in table 11-2 correspondence between requests and decoded values p.589 addition of description in 11.4.1 (3) uf0 epnak register (uf0en) p.599 deletion of description in 11.4.1 (9) uf0 ep status 1 register (uf0eps1) p.601 modification of description in 11.4.1 (11) uf0 int status 0 register (uf0is0) p.629 modification of description in 11.4.1 (34) uf0 mode status register (uf0mods) p.665 modification of description in 11.4.3 (2) uf0 ep0 status register l (uf0e0sl) p.672 modification of description in 11.4.3 (9) uf0 address register (uf0adrs) p.673 modification of description in 11.4.3 (10) uf0 configuration register (uf0cnf) p.674 modification of description in 11.4.3 (11) uf0 interface 0 register (uf0if0) p.675 modification of description in 11.4.3 (12) uf0 interface 1 to 4 registers (uf0if1 to uf0if4) p.677 modification of caution 2 in 11.4.3 (14) uf0 device descriptor registers 0 to 17 (uf0dd0 to uf0dd17) p.678 modification of caution 2 in 11.4.3 (15) uf0 configuration/interface/endpoint descriptor registers 0 to 255 (uf0cie0 to uf0cie255) p.680 modification of caution in 11.4.4 (1) usb function 0 dma channel select register (uf0cs) p.686 deletion of caution in table 11-8 fw-supported standard requests p.692 modification of description in figure 11-15 automatically processed requests for control transfer pp.696, 697, 699, 700, 702 to 704, 706 modification of description in figure 11-20 cpudec request for control transfer p.733 modification of description in figure 11-30 usb connection example p.739 addition of value when f x = 150 mhz in table 12-1 setting of a/d conversion operation time p.763 addition of 12.9 how to read a/d converter characteristics table p.767 modification of repeat frequency in 13.1 features p.768 modification of description in figure 13-1 block diagram of pwm unit p.770 modification of description in 13.3 (1) pwm control registers 0 and 1 (pwmc0 and pwmc1) p.775 modification of description in 13.4.2 (1) setting for starting pwm operation p.779 modification of description in table 13-1 repeat cycle of pwmn p.839 modification of caution in 14.3.8 port dh p.843 modification of caution and description on bit 0 in 14.3.8 (2) (c) port dh function control register (pfcdh) p.853 addition to caution in 14.3.10 (2) (c) port ct function control register (pfcct) p.866 addition of noise elimination width when f x = 150 mhz in table 14-4 relationship between ncw1n register set value and noise elimination width p.873 modification of value of program counter (pc) after reset in table 15-2 initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset p.880 modification of description in 16.1.1 (7) mask function p.885 addition of chapter 17 electrical specifications (target values) p.928 addition of chapter 18 package drawing p.929 addition of chapter 19 recommended soldering conditions p.952 addition to note in b.2 instruction set (in alphabetical order) p.953 addition of appendix c revision history the mark shows major revised points.
10 preliminar y user?s manual u16031ej2v1ud introduction readers this manual is intended for users who wish to understand the functions of the v850e/me2 ( pd703111) to design application systems using the v850e/me2. purpose the purpose of this manual is for users to gain an understanding of the hardware functions of the v850e/me2. organization the v850e/me2 user?s manual is divided into two parts: hardware (this manual) and architecture (v850e1 architecture user?s manual) . the organization of each manual is as follows: hardware architecture ? pin functions ? data type ? cpu function ? register set ? internal peripheral functions ? instruction format and instruction set ? electrical specifications ? interrupts and exceptions (target value) ? pipeline operation how to read this manual it is assumed that the readers of this manual have general knowledge in the fields of electrical engineering, logic circuits, and microcontrollers. ? to find the details of a register where the name is known refer to appendix a register index . ? to understand the details of an instruction function refer to the v850e1 architecture user?s manual . to know the electrical specifications of the v850e/me2 refer to chapter 17 electrical specifications (target values) . ? to understand the overall functions of the v850e/me2 read this manual according to the contents . ? how to interpret the register format for a bit whose bit number is enclosed in brackets, its bit name is defined as a reserved word in the device file.
11 preliminar y user?s manual u16031ej2v1ud conventions data significance: higher digits on the left and lower digits on the right active low representation: xxx (overscore over pin or signal name) memory map address: higher addresses on the top and lower addresses on the bottom note : footnote for item marked with note in the text caution : information requiring particular attention remark : supplementary information numeric representation: binary ... xxxx or xxxxb decimal ... xxxx hexadecimal ... xxxxh prefix indicating power of 2 (address space, memory capacity): k (kilo): 2 10 = 1,024 m (mega): 2 20 = 1,024 2 g (giga): 2 30 = 1,024 3 data type: word ... 32 bits halfword ... 16 bits byte ... 8 bits related documents the related documents indicated in this publication may include preliminary versions. however, preliminary versions are not marked as such. document related to v850e/me2 document name document no. v850e1 architecture user?s manual u14559e v850e/me2 hardware user?s manual this manual document related to development tools (user?s manuals) document name document no. operation u16053e c language u16054e pm plus u16055e ca850 (ver. 2.50) (c compiler package) assembly language u16042e basics u13430e installation u13410e rx850 (ver. 3.13 or later) (real-time os) technical u13431e basics u13773e installation u13774e rx850 pro (ver. 3.15) (real-time os) technical u13772e rd850 (ver. 3.01) (task debugger) u13737e rd850 pro (ver. 3.01) (task debugger) u13916e
preliminary user?s manual u16031ej2v1ud 12 contents chapter 1 introduction...................................................................................................... ..........28 1.1 outline ..................................................................................................................... ...................28 1.2 features.................................................................................................................... ..................29 1.3 applications................................................................................................................ ...............31 1.4 ordering information ........................................................................................................ ........31 1.5 pin configuration ........................................................................................................... ...........32 1.6 function blocks ............................................................................................................. ...........34 1.6.1 internal block diagram .................................................................................................... ..............34 1.6.2 on-chip units ............................................................................................................. ...................35 chapter 2 pin functions .................................................................................................... ..........38 2.1 list of pin functions....................................................................................................... ..........38 2.2 pin status.................................................................................................................. .................46 2.3 description of pin functions ................................................................................................ ...48 2.4 pin i/o circuits and recommended connection of unused pins........................................64 2.5 pin i/o circuits............................................................................................................ ...............67 chapter 3 cpu function ..................................................................................................... ..........68 3.1 features.................................................................................................................... ..................68 3.2 cpu register set............................................................................................................ ...........69 3.2.1 program register set...................................................................................................... ...............70 3.2.2 system register set ....................................................................................................... ...............71 3.3 operating modes ............................................................................................................. ..........74 3.3.1 operating modes........................................................................................................... ...............74 3.3.2 operating mode specification.............................................................................................. .........74 3.4 address space ............................................................................................................... ...........75 3.4.1 cpu address space ......................................................................................................... ............75 3.4.2 image ..................................................................................................................... ......................76 3.4.3 wrap-around of cpu address space .......................................................................................... .77 3.4.4 memory map ................................................................................................................ ................78 3.4.5 area...................................................................................................................... ........................79 3.4.6 recommended use of address space .......................................................................................... 83 3.4.7 peripheral i/o registers .................................................................................................. ..............85 3.4.8 specific registers........................................................................................................ ................111 3.4.9 system wait control register (vswc) ....................................................................................... ..111 3.4.10 initialization sequence .................................................................................................. ..............112 chapter 4 bus control function .........................................................................................114 4.1 features.................................................................................................................... ................114 4.2 bus control pins ............................................................................................................ .........114 4.2.1 pin status during internal instruction ram, internal data ram, and peripheral i/o access ........115 4.3 memory block function....................................................................................................... ...116
preliminary user?s manual u16031ej2v1ud 13 4.3.1 chip select control function .............................................................................................. ..........117 4.4 bus cycle type control function .........................................................................................120 4.4.1 bus cycle type configuration registers 0, 1 (bct0, bct1) .........................................................121 4.5 bus access.................................................................................................................. ............122 4.5.1 number of access clocks ................................................................................................... ........122 4.5.2 bus sizing function ....................................................................................................... ..............123 4.5.3 endian control function ................................................................................................... ...........124 4.5.4 big endian method usage restrictions in nec electronics development tools ...........................125 4.5.5 bus width ................................................................................................................. ..................127 4.5.6 data read control function................................................................................................ ..........146 4.6 bus clock control function .................................................................................................. 150 4.7 wait function ............................................................................................................... ...........152 4.7.1 programmable wait function ................................................................................................ ......152 4.7.2 external wait function.................................................................................................... .............157 4.7.3 relationship between programmable wait and external wait .....................................................157 4.7.4 bus cycles in which wait function is valid ................................................................................ ...158 4.8 idle state insertion function............................................................................................... ...159 4.9 instruction cache function .................................................................................................. .161 4.9.1 cache configuration register (bhc) ........................................................................................ ...161 4.9.2 8 kb 2-way set associative cache.......................................................................................... ....163 4.9.3 lru algorithm ............................................................................................................. ...............163 4.9.4 instruction cache control function........................................................................................ .......164 4.9.5 tag clear function ........................................................................................................ ..............166 4.9.6 auto fill function (way 0 only) ........................................................................................... ..........167 4.10 internal instruction ram control function ..........................................................................168 4.10.1 internal instruction ram mode register (iramm).......................................................................168 4.10.2 operation ................................................................................................................ ...................169 4.10.3 cautions................................................................................................................. ....................170 4.11 bus hold function .......................................................................................................... ........171 4.11.1 function outline......................................................................................................... .................171 4.11.2 bus hold procedure....................................................................................................... .............172 4.11.3 operation in power-save mode ............................................................................................. .....172 4.11.4 bus hold timing .......................................................................................................... ................173 4.11.5 bus hold timing (sram)................................................................................................... ..........174 4.11.6 bus hold timing (sdram) .................................................................................................. ........177 4.12 bus priority order ......................................................................................................... ..........181 4.13 boundary operation conditions ...........................................................................................181 4.13.1 program space........................................................................................................... ................181 4.13.2 data space............................................................................................................... ..................181 4.14 timing at which t0 state is not inserted .............................................................................182 chapter 5 memory access control function ...............................................................183 5.1 sram, external rom, external i/o interface........................................................................183 5.1.1 features.................................................................................................................. ...................183 5.1.2 sram connection .......................................................................................................... ............184 5.1.3 sram, external rom, external i/o access................................................................................18 6 5.2 page rom controller (romc) ...............................................................................................196
preliminary user?s manual u16031ej2v1ud 14 5.2.1 features .................................................................................................................. ...................196 5.2.2 page rom connection ....................................................................................................... ........197 5.2.3 on-page/off-page judgment ................................................................................................ .......198 5.2.4 page rom configuration register (prc) .................................................................................... 199 5.2.5 page rom access ........................................................................................................... ..........200 5.3 dram controller (sdram)..................................................................................................... 206 5.3.1 features ................................................................................................................. ....................206 5.3.2 sdram connection ......................................................................................................... ...........206 5.3.3 address multiplex function ................................................................................................ .........207 5.3.4 sdram configuration registers 1, 3, 4, 6 (scr1, scr3, scr4, scr6)....................................209 5.3.5 sdram access ............................................................................................................. .............212 5.3.6 refresh control function .................................................................................................. ...........236 5.3.7 self-refresh control function ............................................................................................. ..........241 5.3.8 sdram initialization sequence ............................................................................................. .....243 chapter 6 dma functions (dma controller) ..................................................................246 6.1 features.................................................................................................................... ................246 6.2 configuration............................................................................................................... ............247 6.3 control registers ........................................................................................................... .........248 6.3.1 dma source address registers 0 to 3 (dsa0 to dsa3) ..............................................................248 6.3.2 dma destination address registers 0 to 3 (dda0 to dda3) .......................................................250 6.3.3 dma transfer count registers 0 to 3 (dbc0 to dbc3) ................................................................252 6.3.4 dma addressing control registers 0 to 3 (dadc0 to dadc3)....................................................253 6.3.5 dma channel control registers 0 to 3 (dchc0 to dchc3) ........................................................256 6.3.6 dma terminal count output control register (dtoc)...................................................................259 6.3.7 dma trigger factor registers 0 to 3 (dtfr0 to dtfr3) ..............................................................260 6.3.8 dma interface control register (difc) ..................................................................................... ...266 6.4 transfer modes.............................................................................................................. ..........267 6.4.1 single transfer mode ...................................................................................................... ............267 6.4.2 single-step transfer mode ................................................................................................. .........269 6.4.3 block transfer mode ...................................................................................................... .............270 6.5 transfer types.............................................................................................................. ...........271 6.5.1 2-cycle transfer.......................................................................................................... .................271 6.5.2 flyby transfer ............................................................................................................ .................288 6.6 transfer object............................................................................................................. ...........302 6.6.1 transfer type and transfer object ........................................................................................ .......302 6.6.2 external bus cycles during dma transfer ................................................................................... 304 6.7 dma channel priorities ...................................................................................................... ....304 6.8 next address setting function..............................................................................................3 05 6.9 dma transfer start factors .................................................................................................. .307 6.10 terminal count output upon dma transfer end.................................................................309 6.11 forcible interruption ...................................................................................................... .........310 6.12 forcible termination....................................................................................................... ........311 6.13 times related to dma transfer.............................................................................................3 12 6.14 maximum response time for dma transfer request ........................................................312 6.15 cautions ................................................................................................................... ................314 6.15.1 interrupt factors ........................................................................................................ ..................315
preliminary user?s manual u16031ej2v1ud 15 6.16 dma transfer end........................................................................................................... ........315 chapter 7 interrupt/exception processing function................................................316 7.1 features .................................................................................................................... ...............316 7.2 non-maskable interrupts..................................................................................................... ...320 7.2.1 operation ................................................................................................................. ..................321 7.2.2 restore ................................................................................................................... ...................323 7.2.3 non-maskable interrupt status flag (np) ................................................................................... .324 7.2.4 edge detection function ................................................................................................... ..........324 7.3 maskable interrupts ......................................................................................................... .......325 7.3.1 operation ................................................................................................................. ..................325 7.3.2 restore ................................................................................................................... ...................327 7.3.3 priorities of maskable interrupts......................................................................................... ........328 7.3.4 interrupt control register (xxicn) ........................................................................................ ........332 7.3.5 interrupt mask registers 0 to 5 (imr0 to imr5) ..........................................................................33 5 7.3.6 nmi reset status register (nrs) ........................................................................................... ......337 7.3.7 in-service priority register (ispr) ....................................................................................... ........338 7.3.8 maskable interrupt status flag (id) ....................................................................................... ......338 7.3.9 selecting interrupt trigger mode .......................................................................................... .......339 7.4 software exception.......................................................................................................... .......354 7.4.1 operation ................................................................................................................. ..................354 7.4.2 restore ................................................................................................................... ...................355 7.4.3 exception status flag (ep)............................................................................................... ...........356 7.5 exception trap .............................................................................................................. ..........357 7.5.1 illegal opcode definition ................................................................................................. ............357 7.5.2 debug trap ................................................................................................................ .................359 7.6 multiple interrupt servicing control......................................................................................36 1 7.7 interrupt latency time ...................................................................................................... .....363 7.8 periods in which interrupts are not acknowledged ..........................................................364 chapter 8 clock generation function .............................................................................365 8.1 features .................................................................................................................... ...............365 8.2 configuration............................................................................................................... ............366 8.3 control registers ........................................................................................................... .........366 8.3.1 clock control register (ckc) .............................................................................................. ........366 8.3.2 clock source select register (cks) ........................................................................................ ....369 8.3.3 sscg control register (sscgc) ............................................................................................. ...371 8.3.4 usb clock control register (uckc) ......................................................................................... ...373 8.3.5 lock register (lockr)..................................................................................................... ..........374 8.3.6 oscillation stabilization time select register (osts)...................................................................37 5 8.4 operation ................................................................................................................... ..............376 8.4.1 operation status of each clock............................................................................................ .......376 8.4.2 setting of input clock (f x )...........................................................................................................376 8.5 operating clock provisions.................................................................................................. .377 8.5.1 calculating busclk frequency .............................................................................................. ...378 8.5.2 calculating operating clock frequency of each on-chip peripheral function................................378 8.6 power-save control.......................................................................................................... ......381
preliminary user?s manual u16031ej2v1ud 16 8.6.1 overview .................................................................................................................. ..................381 8.6.2 control registers......................................................................................................... ................383 8.6.3 halt mode ................................................................................................................. ...............386 8.6.4 idle mode ................................................................................................................. ................390 8.6.5 software stop mode ........................................................................................................ ........394 8.7 securing oscillation stabilization time................................................................................400 8.7.1 oscillation stabilization time security specification ..................................................................... 400 8.7.2 time base counter (tbc) ................................................................................................... ........400 chapter 9 timer/counter function (real-time pulse unit)......................................401 9.1 timer c ..................................................................................................................... ................401 9.1.1 features .................................................................................................................. ...................401 9.1.2 function overview ......................................................................................................... .............401 9.1.3 basic configuration....................................................................................................... ..............402 9.1.4 timer c ................................................................................................................... ...................404 9.1.5 control registers......................................................................................................... ................408 9.1.6 operation ................................................................................................................. ..................416 9.1.7 application examples ...................................................................................................... ...........423 9.1.8 cautions .................................................................................................................. ...................430 9.2 timer d ..................................................................................................................... ................431 9.2.1 features .................................................................................................................. ...................431 9.2.2 function overview ......................................................................................................... .............431 9.2.3 basic configuration....................................................................................................... ..............431 9.2.4 timer d ................................................................................................................... ...................432 9.2.5 control registers......................................................................................................... ................435 9.2.6 operation ................................................................................................................. ..................437 9.2.7 application examples ...................................................................................................... ...........439 9.2.8 cautions .................................................................................................................. ...................439 9.3 timer enc1 .................................................................................................................. ............440 9.3.1 features .................................................................................................................. ...................440 9.3.2 function overview ......................................................................................................... .............440 9.3.3 basic configuration....................................................................................................... ..............442 9.3.4 timer enc1 ................................................................................................................ ...............444 9.3.5 control registers......................................................................................................... ................449 9.3.6 operation ................................................................................................................. ..................460 9.3.7 supplementary description of internal operation ........................................................................472 chapter 10 serial interface function...............................................................................476 10.1 features................................................................................................................... .................476 10.1.1 switching between uartb0 and csi30 modes.........................................................................476 10.2 asynchronous serial interfaces b0, b1 (uartb0, uartb1) .............................................477 10.2.1 features ................................................................................................................. ....................477 10.2.2 configuration............................................................................................................ ..................478 10.2.3 control registers........................................................................................................ .................482 10.2.4 interrupt requests ....................................................................................................... ................499 10.2.5 control method........................................................................................................... ................502 10.2.6 operation ................................................................................................................ ...................505
preliminary user?s manual u16031ej2v1ud 17 10.2.7 dedicated baud rate generators 0, 1 (brg0, brg1).................................................................516 10.2.8 control flow ............................................................................................................. ...................522 10.2.9 cautions................................................................................................................. ....................532 10.3 clocked serial interfaces 30, 31 (csi30, csi31)...................................................................533 10.3.1 features................................................................................................................. ....................533 10.3.2 configuration............................................................................................................ ..................534 10.3.3 control registers........................................................................................................ .................536 10.3.4 dedicated baud rate generators 0, 1 (brg0, brg1).................................................................548 10.3.5 operation ................................................................................................................ ...................550 10.3.6 usage .................................................................................................................... ....................568 10.3.7 cautions................................................................................................................. ....................574 chapter 11 usb function controller (usbf) .................................................................575 11.1 overview ................................................................................................................... ...............575 11.2 configuration.............................................................................................................. .............576 11.3 requests ................................................................................................................... ...............577 11.3.1 automatic requests ....................................................................................................... .............577 11.3.2 other requests ........................................................................................................... ................585 11.4 register configuration ..................................................................................................... ......586 11.4.1 control registers........................................................................................................ .................586 11.4.2 data hold registers...................................................................................................... ...............639 11.4.3 request data register area ............................................................................................... .........664 11.4.4 peripheral control registers ............................................................................................. ...........680 11.5 stall handshake or no handshake ...................................................................................682 11.6 register values in specific status ........................................................................................6 83 11.7 fw processing .............................................................................................................. ..........685 11.7.1 initialization processing................................................................................................ ..............687 11.7.2 interrupt servicing ...................................................................................................... ................690 11.7.3 usb main processing ...................................................................................................... ..........691 11.7.4 suspend/resume processing ................................................................................................ ....718 11.7.5 processing after power application ....................................................................................... .....721 11.7.6 receiving data for bulk transfer (out) in dma mode................................................................724 11.7.7 transmitting data for bulk transfer (in) in dma mode................................................................728 11.7.8 usb connection example................................................................................................... ........733 chapter 12 a/d converter ................................................................................................... .....734 12.1 features ................................................................................................................... ................734 12.2 configuration.............................................................................................................. .............735 12.3 control registers .......................................................................................................... ..........737 12.4 operation .................................................................................................................. ...............744 12.4.1 basic operation .......................................................................................................... ................744 12.4.2 operation mode and trigger mode .......................................................................................... ...745 12.5 operation in a/d trigger mode.............................................................................................. 750 12.5.1 select mode operation .................................................................................................... ...........750 12.5.2 scan mode operations ..................................................................................................... ..........752 12.6 operation in timer trigger mode ..........................................................................................75 3 12.6.1 select mode operation .................................................................................................... ...........754
preliminary user?s manual u16031ej2v1ud 18 12.6.2 scan mode operation ...................................................................................................... ...........756 12.7 operation in external trigger mode ......................................................................................757 12.7.1 select mode operations................................................................................................... ...........757 12.7.2 scan mode operation ...................................................................................................... ...........760 12.8 notes on operation ......................................................................................................... ........761 12.9 how to read a/d converter characteristics table..............................................................763 chapter 13 pwm unit ........................................................................................................ ............767 13.1 features................................................................................................................... .................767 13.2 configuration.............................................................................................................. .............767 13.3 control registers .......................................................................................................... ..........769 13.4 operation .................................................................................................................. ...............772 13.4.1 pwm basic operation ...................................................................................................... ...........772 13.4.2 starting/stopping pwm operation.......................................................................................... .....775 13.4.3 setting active level of pwm pulse ........................................................................................ ......777 13.4.4 specifying pwm pulse width rewrite period ...............................................................................7 78 13.4.5 repeat cycle ............................................................................................................. .................779 chapter 14 port functions .................................................................................................. ....780 14.1 features................................................................................................................... .................780 14.2 port configuration......................................................................................................... ..........780 14.3 port pin functions ......................................................................................................... .........809 14.3.1 port 1................................................................................................................... .......................809 14.3.2 port 2................................................................................................................... .......................814 14.3.3 port 5................................................................................................................... .......................819 14.3.4 port 6................................................................................................................... .......................824 14.3.5 port 7................................................................................................................... .......................829 14.3.6 port al .................................................................................................................. .....................832 14.3.7 port ah.................................................................................................................. .....................837 14.3.8 port dh .................................................................................................................. ....................839 14.3.9 port cs.................................................................................................................. .....................848 14.3.10 port ct................................................................................................................. ......................851 14.3.11 port cm ................................................................................................................. .....................854 14.3.12 port cd ................................................................................................................. .....................857 14.4 configuration of reset, a2 to a15, and d0 to d15 pins....................................................859 14.5 operation of port function ................................................................................................. ...861 14.5.1 writing to i/o port ...................................................................................................... .................861 14.5.2 reading from i/o port.................................................................................................... .............861 14.5.3 output status of alternate function in control mode ....................................................................86 1 14.6 noise eliminator ........................................................................................................... ...........862 14.6.1 interrupt input pin ...................................................................................................... .................862 14.6.2 a/d converter input pin.................................................................................................. .............863 14.6.3 timer c and timer enc1 input pins........................................................................................ ....863 chapter 15 reset functions ................................................................................................. ...867 15.1 overview ................................................................................................................... ...............867
preliminary user?s manual u16031ej2v1ud 19 15.2 configuration.............................................................................................................. .............867 15.3 operation .................................................................................................................. ...............868 15.4 initialization ............................................................................................................. ................873 chapter 16 debug function (dcu) .........................................................................................87 9 16.1 functional outline ......................................................................................................... .........879 16.1.1 debug function........................................................................................................... ................879 16.1.2 trace function ........................................................................................................... .................880 16.1.3 event function ........................................................................................................... .................881 16.2 connection with n-wire type ie............................................................................................8 82 16.2.1 ie connector (on target system side) ..................................................................................... ....883 16.2.2 recommended circuit example.............................................................................................. ....884 chapter 17 electrical specifications (target values)............................................885 chapter 18 package drawing ................................................................................................. 928 chapter 19 recommended soldering conditions .........................................................929 appendix a register index .................................................................................................. ......930 appendix b instruction set list ........................................................................................... .943 b.1 conventions ................................................................................................................ ............943 b.2 instruction set (in alphabetical order) .................................................................................946 appendix c revision history ................................................................................................ ....953
preliminary user?s manual u16031ej2v1ud 20 list of figures (1/6) figure no. title page 3-1 cpu register set............................................................................................................ ..............................69 3-2 cpu address space ........................................................................................................... ..........................75 3-3 images on address space..................................................................................................... .......................76 3-4 memory map .................................................................................................................. ...............................78 3-5 recommended memory map...................................................................................................... ..................84 4-1 example when csc0 register is set to 0803h and csc1 register is set to 0601h................................119 4-2 big endian addresses within word ............................................................................................ ................125 4-3 little endian addresses within word......................................................................................... .................125 4-4 outline of speculative read operation....................................................................................... ................148 4-5 bmc register switching timing ............................................................................................... ..................151 4-6 example of wait insertion ................................................................................................... ........................157 4-7 configuration of 8 kb 2-way set associative instruction cache ............................................................... .163 4-8 memory map of internal instruction ram...................................................................................... ..............168 5-1 examples of connection to sram.............................................................................................. ................184 5-2 sram, external rom, external i/o access timing .............................................................................. ......186 5-3 examples of connection to page rom .......................................................................................... ............197 5-4 example of control by ma6 to ma3 bits of prc register ....................................................................... ...198 5-5 page rom access timing...................................................................................................... ....................200 5-6 example of connection to sdram .............................................................................................. ...............206 5-7 row address/column address output ........................................................................................... ............207 5-8 state transition of sdram access ............................................................................................ ................212 5-9 sdram single read cycle ..................................................................................................... ...................214 5-10 sdram single write cycle................................................................................................... ......................220 5-11 sdram access timing........................................................................................................ .......................227 5-12 auto-refresh cycle......................................................................................................... ............................239 5-13 cbr refresh timing (sdram)................................................................................................. ..................240 5-14 self-refresh timing (sdram) ................................................................................................ ....................242 5-15 sdram mode register setting cycle.......................................................................................... ...............244 5-16 sdram register write operation timing...................................................................................... .............245 6-1 single transfer example 1................................................................................................... .......................267 6-2 single transfer example 2................................................................................................... .......................267 6-3 single transfer example 3................................................................................................... .......................268 6-4 single transfer example 4................................................................................................... .......................268 6-5 single-step transfer example 1 .............................................................................................. ...................269 6-6 single-step transfer example 2 .............................................................................................. ...................269 6-7 block transfer example...................................................................................................... ........................270 6-8 timing of 2-cycle dma transfer (sram external i/o)...........................................................................271 6-9 timing of 2-cycle dma transfer (sdram sram): single transfer mode (sram data 1 wait, sdram latency = 2, bmc register = 00h, level detection mode)..........................273 6-10 timing of 2-cycle dma transfer (sram sdram): single transfer mode (sram data 1 wait, bmc register = 00h, edge detection mode) ...........................................................274
preliminary user?s manual u16031ej2v1ud 21 list of figures (2/6) figure no. title page 6-11 timing of 2-cycle dma transfer (sram external i/o): without speculative read ...............................275 6-12 timing of 2-cycle dma transfer (sdram sram) ................................................................................276 6-13 bus configuration .......................................................................................................... .............................278 6-14 outline of timing during 2-cycle transfer (sram sram): divided by 1 (0 sram waits)....................282 6-15 outline of timing during 2-cycle transfer (sram sram): divided by 2 (0 sram waits)....................283 6-16 outline of timing during 2-cycle transfer (sram sram): divided by 3 (0 sram waits)....................284 6-17 outline of timing during 2-cycle transfer (sram sram): divided by 4 (0 sram waits)....................286 6-18 circuit example when flyby transfer is performed between external i/o and sram..............................288 6-19 timing of dma flyby transfer (external i/o sdram) ...........................................................................289 6-20 timing of dma flyby transfer (sram external i/o) ..............................................................................292 6-21 timing of dma flyby transfer (external i/o sram) ..............................................................................294 6-22 timing of dma flyby transfer (page rom external i/o).......................................................................296 6-23 timing of dma flyby transfer (sdram external i/o) ...........................................................................298 6-24 timing of dma flyby transfer (external i/o sdram) ...........................................................................300 6-25 buffer register configuration .............................................................................................. .......................305 6-26 terminal count signal (tcn) timing example (1) ............................................................................. .........309 6-27 terminal count signal (tcn) timing example (2) ............................................................................. .........309 6-28 example of forcible termination of dma transfer............................................................................ .........311 7-1 servicing configuration of non-maskable interrupt ........................................................................... .........321 7-2 acknowledging non-maskable interrupt request................................................................................ .......322 7-3 reti instruction processing ................................................................................................. ......................323 7-4 maskable interrupt servicing ................................................................................................ ......................326 7-5 reti instruction processing ................................................................................................. ......................327 7-6 example of processing in which another interrupt request is issued while an interrupt is being serviced .................................................................................................... .....................329 7-7 example of servicing interrupt requests simultaneously generated ........................................................331 7-8 software exception processing ............................................................................................... ...................354 7-9 reti instruction processing ................................................................................................. ......................355 7-10 exception trap processing.................................................................................................. .......................358 7-11 restore processing from exception trap ..................................................................................... ..............358 7-12 debug trap processing ...................................................................................................... ........................359 7-13 restore processing from debug trap ......................................................................................... ...............360 7-14 pipeline operation at interrupt request acknowledgment (outline)........................................................... 363 8-1 power-save mode state transition diagram.................................................................................... ..........382 8-2 busclk operation when halt mode is released ................................................................................. .389 8-3 busclk operation when idle mode is released ................................................................................. ..393 8-4 busclk operation when software stop mode is released...................................................................398 9-1 timer c block diagram....................................................................................................... ........................403 9-2 basic operation of timer c .................................................................................................. ......................416 9-3 operation after overflow (when ostcn = 1) ................................................................................... .........417 9-4 capture operation example ................................................................................................... ....................418
preliminary user?s manual u16031ej2v1ud 22 list of figures (3/6) figure no. title page 9-5 tmc1 capture operation example (when both edges are specified) ......................................................419 9-6 compare operation example ................................................................................................... ..................420 9-7 tmc1 compare operation example (set/reset output mode) ..................................................................422 9-8 contents of register settings when timer c is used as interval timer.....................................................423 9-9 interval timer operation timing example..................................................................................... ..............424 9-10 contents of register settings when timer c is used for pwm output......................................................425 9-11 pwm output operation timing example ........................................................................................ ............426 9-12 contents of register settings when timer c is used for cycle measurement ..........................................428 9-13 cycle measurement operation timing example................................................................................. ........429 9-14 timer d block diagram...................................................................................................... .........................431 9-15 example of timing during tmdn operation .................................................................................... ...........434 9-16 tmd0 compare operation example............................................................................................. ..............437 9-17 timer enc1 block diagram................................................................................................... .....................443 9-18 tmenc1n block diagram (during pwm output operation).......................................................................4 62 9-19 pwm signal output example (when alvt1n0 bit = 0 is set).................................................................... 463 9-20 mode 1 (when rising edge is specified as valid edge of tiud1n pin) .....................................................465 9-21 mode 1 (when rising edge is specified as valid edge of tiud1n pin): in case of simultaneous tiud1n, tcud1n pin edge timing ....................................................................465 9-22 mode 2 (when rising edge is specified as valid edge of tiud1n, tcud1n pins) ...................................466 9-23 mode 3 (when rising edge is specified as valid edge of tiud1n pin) .....................................................467 9-24 mode 3 (when rising edge is specified as valid edge of tiud1n pin): in case of simultaneous tiud1n, tcud1n pin edge timing ....................................................................467 9-25 mode 4..................................................................................................................... ...................................468 9-26 example of tmenc1n operation when interval operation and transfer operation are combined ..........469 9-27 example of tmenc1n operation in udc mode ................................................................................... ......471 9-28 clear operation upon match with cm1n0 during tmenc1n up count operation .....................................472 9-29 clear operation upon match with cm1n1 during tmenc1n down count operation.................................472 9-30 count value clear operation upon compare match............................................................................. ......473 9-31 internal operation during transfer operation............................................................................... ..............473 9-32 interrupt output upon compare match (cm1n1 with operation mode set to general-purpose timer mode and count clock set to f x /8)...................................................474 9-33 ubd1n flag operation....................................................................................................... .........................474 10-1 block diagram of asynchronous serial interfaces b0 and b1 .................................................................. ..481 10-2 asynchronous serial interface transmit/receive data format (lsb-first transfer) ..................................505 10-3 timing of asynchronous serial interface transmission completion interrupt (ubtitn) .............................508 10-4 timing of asynchronous serial interface fifo transmission completion interrupt (ubtifn) ....................508 10-5 timing of asynchronous serial interface reception completion interrupt (ubtirn) ..................................512 10-6 noise filter circuit....................................................................................................... ................................515 10-7 timing of rxdn signal judged as noise ...................................................................................... ..............515 10-8 baud rate generator configuration.......................................................................................... ..................516 10-9 allowable baud rate range during reception ................................................................................. .........519 10-10 transfer rate during continuous transmission .............................................................................. ...........521 10-11 example of continuous transmission processing flow in single mode (cpu control) .............................522
preliminary user?s manual u16031ej2v1ud 23 list of figures (4/6) figure no. title page 10-12 example of continuous reception processing flow in single mode (cpu control) ..................................523 10-13 example of continuous transmission processing flow in single mode (dma control).............................524 10-14 example of continuous reception processing flow in single mode (dma control)..................................525 10-15 example of continuous transmission processing flow in fifo mode (cpu control)...............................526 10-16 example of continuous reception processing in fifo mode (cpu control).............................................527 10-17 example of continuous transmission (pending mode) processing in fifo mode (dma control).............528 10-18 example of continuous reception (pending mode) processing flow in fifo mode (dma control) .........529 10-19 example of reception error processing in single mode ...................................................................... ......530 10-20 example of reception error processing flow in fifo mode (1) ............................................................... .531 10-21 example of reception error processing flow in fifo mode (2) ............................................................... .532 10-22 block diagram of clocked serial interfaces 30 and 31...................................................................... .........535 10-23 transfer clock of csi3n ................................................................................................... ..........................548 10-24 function of csi data buffer register n (csibufn) .......................................................................... ..........551 10-25 transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: msb first (dirn bit = 0 in csim3n register)...............................................................5 52 10-26 transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: lsb first (dirn bit = 1 in csim3n register)................................................................ 554 10-27 transfer data length: 16 bits (ccln3 to ccln0 bits = 0000 in csil3n register), transfer direction: msb first (dirn bit = 0 in csim3n register)...............................................................5 56 10-28 clock timing.............................................................................................................. .................................557 10-29 master mode (ckpn and dapn bits = 00 in csic3n register, ccln3 to ccln0 bits = 1000 in csil3n register (transfer data length: 8 bits)) .....................................558 10-30 slave mode (ckpn and dapn bits = 00 in csic3n register, ccln3 to ccln0 bits = 1000 in csil3n register (transfer data length: 8 bits)) .....................................559 10-31 single mode............................................................................................................... .................................561 10-32 continuous mode ........................................................................................................... ............................563 10-33 delay control of transmission/reception completion interrupt (intcsi3n): csitn bit = 1 in csic3n register, cswen bit = 0, ckpn and dapn bits = 00, ccln3 to ccln0 bits = 1000 in csil3n register (transfer data length: 8 bits) ......................................565 10-34 enabling/disabling transfer wait .......................................................................................... .....................566 11-1 operation of uf0e0r register............................................................................................... ....................640 11-2 operation of uf0e0st register.............................................................................................. ...................642 11-3 operation of uf0e0w register ............................................................................................... ...................644 11-4 operation of uf0bo1 register............................................................................................... ....................646 11-5 operation of uf0bo2 register............................................................................................... ....................650 11-6 operation of uf0bi1 register ............................................................................................... .....................653 11-7 operation of uf0bi2 register ............................................................................................... .....................657 11-8 operation of uf0int1 register .............................................................................................. ....................661 11-9 operation of uf0int2 register .............................................................................................. ....................663 11-10 initializing request data register area ................................................................................... ...................687 11-11 initialization of request data register area .............................................................................. .................688 11-12 setting of interface and endpoint ......................................................................................... ......................688 11-13 setting of interrupt ...................................................................................................... ................................689
preliminary user?s manual u16031ej2v1ud 24 list of figures (5/6) figure no. title page 11-14 interrupt servicing....................................................................................................... ................................690 11-15 automatically processed requests for control transfer..................................................................... ........692 11-16 clear_feature processing .................................................................................................. ................693 11-17 set_feature processing .................................................................................................... ...................694 11-18 set_configuration processing .............................................................................................. ............695 11-19 set_interface processing .................................................................................................. ..................695 11-20 cpudec request for control transfer ....................................................................................... ...............696 11-21 processing for bulk transfer (in) (endpoint1) ............................................................................. ...............709 11-22 parallel processing by hardware ........................................................................................... .....................710 11-23 normal processing for bulk transfer (out) (endpoint2)..................................................................... .......712 11-24 processing if more data than expected by system is transmitted (endpoint2)........................................714 11-25 processing for interrupt transfer (in) (endpoint7) ........................................................................ ..............717 11-26 example of suspend/resume processing...................................................................................... ............718 11-27 example of processing after power application/power failure ............................................................... ...721 11-28 dma processing by bulk transfer (out) ..................................................................................... ..............725 11-29 dma processing by bulk transfer (in) ...................................................................................... .................729 11-30 usb connection example .................................................................................................... ......................733 12-1 block diagram of a/d converter ............................................................................................. ....................736 12-2 relationship between analog input voltage and a/d conversion results .................................................743 12-3 select mode operation timing: 1-buffer mode (ani1)......................................................................... .......747 12-4 select mode operation timing: 4-buffer mode (ani2)......................................................................... .......748 12-5 scan mode operation timing: 4-channel scan (ani0 to ani3) .................................................................7 49 12-6 example of 1-buffer mode operation (a/d trigger select: 1 buffer).......................................................... .750 12-7 example of 4-buffer mode operation (a/d trigger select: 4 buffers)......................................................... 751 12-8 example of scan mode operation (a/d trigger scan) .......................................................................... .....752 12-9 example of 1-buffer mode operation (timer trigger select: 1 buffer) (ani1) ............................................754 12-10 example of 4-buffer mode operation (timer trigger select: 4 buffers) (ani3) ..........................................755 12-11 example of scan mode operation (timer trigger scan) (ani0 to ani4) ....................................................756 12-12 example of 1-buffer mode operation (external trigger select: 1 buffer) (ani1) ........................................758 12-13 example of 4-buffer mode operation (external trigger select: 4 buffers) (ani2) ......................................759 12-14 example of scan mode operation (external trigger scan) (ani0 to ani3) ................................................760 12-15 overall error ............................................................................................................. ..................................763 12-16 quantization error........................................................................................................ ...............................764 12-17 zero-scale error .......................................................................................................... ...............................764 12-18 full-scale error .......................................................................................................... .................................765 12-19 differential linearity error .............................................................................................. .............................765 12-20 integral linearity error .................................................................................................. ..............................766 12-21 sampling time ............................................................................................................. ...............................766 13-1 block diagram of pwm unit .................................................................................................. .....................768 13-2 example of pwm output with main pulse and ancillary pulse .................................................................. .773 13-3 example of pwm output operation............................................................................................ ................774 13-4 pwm operation timing....................................................................................................... ........................776
preliminary user?s manual u16031ej2v1ud 25 list of figures (6/6) figure no. title page 13-5 setting active level of pwm output......................................................................................... ..................777 13-6 pwm output timing example 1 (pwm pulse width rewrite period: 2 x+8 /f pwmc ) ........................................778 13-7 pwm output timing example 2 (pwm pulse width rewrite period: 2 x /f pwmc ) ..........................................779 14-1 block diagram of type a-1.................................................................................................. .......................785 14-2 block diagram of type c-1.................................................................................................. .......................786 14-3 block diagram of type d-1.................................................................................................. .......................787 14-4 block diagram of type d-2.................................................................................................. .......................788 14-5 block diagram of type f-1 .................................................................................................. .......................789 14-6 block diagram of type f-2 .................................................................................................. .......................790 14-7 block diagram of type f-3 .................................................................................................. .......................791 14-8 block diagram of type f-4 .................................................................................................. .......................792 14-9 block diagram of type f-5 .................................................................................................. .......................793 14-10 block diagram of type g-1 ................................................................................................. .......................794 14-11 block diagram of type g-2 ................................................................................................. .......................795 14-12 block diagram of type g-3 ................................................................................................. .......................796 14-13 block diagram of type h-1................................................................................................. ........................797 14-14 block diagram of type j-1 ................................................................................................. ........................798 14-15 block diagram of type j-2 ................................................................................................. ........................799 14-16 block diagram of type j-3 ................................................................................................. ........................800 14-17 block diagram of type l-1 ................................................................................................. ........................801 14-18 block diagram of type l-2 ................................................................................................. ........................802 14-19 block diagram of type l-3 ................................................................................................. ........................803 14-20 block diagram of type l-4 ................................................................................................. ........................804 14-21 block diagram of type l-5 ................................................................................................. ........................805 14-22 block diagram of type m-1 ................................................................................................. .......................806 14-23 block diagram of type m-2 ................................................................................................. .......................807 14-24 block diagram of type m-3 ................................................................................................. .......................808 14-25 block diagram of type n-1................................................................................................. ........................859 14-26 block diagram of type n-2................................................................................................. ........................859 14-27 block diagram of type n-3................................................................................................. ........................860 15-1 reset operation with reset pin input ....................................................................................... ...............869 15-2 power-on reset operation ................................................................................................... ......................871 15-3 busclk operation at power-on reset ......................................................................................... .............872 16-1 connecting n-wire type ie .................................................................................................. ......................882 16-2 example of recommended ie connection circuit............................................................................... .......884
preliminary user?s manual u16031ej2v1ud 26 list of tables (1/2) table no. title page 3-1 program registers ........................................................................................................... .............................70 3-2 system register numbers ..................................................................................................... .......................71 3-3 interrupt/exception table................................................................................................... ...........................79 4-1 bus cycles in which wait function is valid.................................................................................. ..............158 4-2 bus priority order .......................................................................................................... .............................181 5-1 example of interval factor settings ......................................................................................... ...................238 6-1 targets of 2-cycle transfer ................................................................................................. .......................278 6-2 active width of dmaakn signal for 2-cycle transfer.......................................................................... .......279 6-3 correlation between external access (execution to external i/o/external memory) and active width of dmaakn signal .............................................................................................. ............279 6-4 minimum value of active width of dmaakn signal during 2-cycle transfer.............................................281 6-5 relationship between transfer type and transfer object ...................................................................... ...302 6-6 external bus cycles during dma transfer ..................................................................................... ............304 6-7 number of minimum execution clocks in dma cycle............................................................................. ....312 7-1 interrupt/exception source list............................................................................................. ......................317 7-2 addresses and bits of interrupt control registers ........................................................................... ...........333 8-1 operation status of each clock.............................................................................................. ....................376 8-2 frequency list .............................................................................................................. ..............................376 8-3 frequency fluctuation of busclk ............................................................................................. ................378 8-4 operation status in halt mode ............................................................................................... ..................387 8-5 operation after halt mode is released by interrupt request .................................................................. 388 8-6 operation status in idle mode ............................................................................................... ...................391 8-7 operation after idle mode is released by interrupt request .................................................................. .392 8-8 operation status in software stop mode ...................................................................................... ...........395 8-9 operation after software stop mode is released by interrupt request...................................................396 8-10 operation if software stop mode is set in interrupt servicing routine ....................................................39 7 8-11 counting time examples..................................................................................................... .......................400 9-1 timer c configuration....................................................................................................... ..........................402 9-2 tocn output control ......................................................................................................... .........................422 9-3 timer d configuration....................................................................................................... ..........................431 9-4 timer enc1 configuration.................................................................................................... ......................442 9-5 timer enc1 (tmenc1n) clear conditions....................................................................................... ..........445 9-6 relationship between ncw1n register set value and noise elimination width .......................................459 9-7 capture trigger signal (tmenc1n) to 16-bit capture register ................................................................. 462 9-8 list of count operations in udc mode........................................................................................ ...............464 10-1 division value of 16-bit counter ........................................................................................... ......................487 10-2 generated interrupts and default priorities................................................................................ .................499
preliminary user?s manual u16031ej2v1ud 27 list of tables (2/2) table no. title page 10-3 reception error causes ..................................................................................................... ........................513 10-4 baud rate generator setting data........................................................................................... ..................518 10-5 maximum and minimum allowable baud rate error .............................................................................. ....520 10-6 operation modes ............................................................................................................ ............................550 10-7 conditions under which data can be transferred in slave mode ............................................................559 10-8 default output level of sckn pin ........................................................................................... ...................567 10-9 default output level of son pin............................................................................................ .....................567 11-1 request format............................................................................................................. .............................577 11-2 correspondence between requests and decoded values ........................................................................5 78 11-3 response and processing of other requests.................................................................................. ..........585 11-4 mapping and data of uf0 device descriptor registers ........................................................................ .....677 11-5 mapping of uf0cien register................................................................................................ ....................678 11-6 data of uf0cien register ................................................................................................... .......................679 11-7 register values in specific status......................................................................................... .....................683 11-8 fw-supported standard requests............................................................................................. ................686 12-1 setting of a/d conversion operation time................................................................................... ..............739 12-2 relationship between operation mode and trigger mode ....................................................................... ..745 12-3 correspondence between analog input pins and adcrn register (1-buffer mode (timer trigger select: 1 buffer)) ............................................................................... .........754 12-4 correspondence between analog input pins and adcrn register (4-buffer mode (timer trigger select: 4 buffers)) .............................................................................. ........755 12-5 correspondence between analog input pins and adcrn register (scan mode (timer trigger scan)) ............................................................................................... ..............756 13-1 repeat cycle of pwmn ....................................................................................................... .......................779 14-1 noise elimination time of interrupt input pins............................................................................. ...............862 14-2 noise elimination time of a/d converter input pin .......................................................................... ..........863 14-3 noise elimination time of timer c and timer enc1 input pins................................................................ .863 14-4 relationship between ncw1n register set value and noise elimination width .......................................866 15-1 hardware status at reset................................................................................................... ........................868 15-2 initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset ......................................................................................... ............873 16-1 ie connector pin function (on target system side) .......................................................................... ........883 19-1 surface mounting type soldering conditions................................................................................. ............929
28 preliminar y user?s manual u16031ej2v1ud chapter 1 introduction the v850e/me2 is a product of the nec electronics single-chip microcontroller ?v850 series tm ?. this chapter gives a simple outline of the v850e/me2. 1.1 outline the v850e/me2 is a 32-bit single-chip microcontroller that integrates the v850e1 cpu, which is a 32-bit risc- type cpu core for asic, newly developed as the cpu core central to system lsi for the current age of system-on- chip. this device incorporates cache, data ram, instruction ram, and various peripheral functions such as memory controllers, a dma controller, real-time pulse unit, serial interfaces, usb function controller (usbf), and an a/d converter for realizing high-capacity data processing and sophisticated real-time control. (1) v850e1 cpu the v850e1 cpu is a cpu core that enhances the external bus interface performance of the v850 cpu, which is the cpu core integrated in the v850 series, and has added instructions supporting high-level languages, such as c-language switch statement processing, table lookup branching, stack frame creation/deletion, and data conversion. this enhances the performance of both data processing and control. it is possible to use the software resources of the v850 cpu integrated system since the instruction codes of the v850e1 are upwardly compatible at the object code level with those of the v850 cpu. (2) external memory interface function the v850e/me2 features various on-chip external memory interfaces including separately configured address (26 bits) and data (32 bits) buses, and sdram and rom interfaces, as well as on-chip memory controllers that can be directly linked to page rom, etc., thereby raising system performance and reducing the number of parts needed for application systems. also, through the dma controller, cpu internal calculations and data transfers can be performed simultaneously with transfers to and from the external memory, so it is possible to process large volumes of image data or voice data, etc., and through high-speed execution of instructions using internal data ram and instruction ram, motor control, communications control and other real-time control tasks can be realized simultaneously. (3) internal instruction ram the instruction ram can be accessed at high speed, in one clock, so that application programs can be executed in real time. (4) a full range of middleware and development environment products the v850e/me2 can execute middleware such as jpeg, jbig, mh/mr/mmr, and tcp/ip at high speed. also, middleware that enables speech recognition, voice synthesis, and other such processing is available, and by including these middleware programs, a multimedia system can be easily realized. a development environment system that includes an optimized c compiler, debugger, in-circuit emulator, and other elements is also available.
chapter 1 introduction 29 preliminar y user?s manual u16031ej2v1ud 1.2 features { number of instructions: 83 { minimum instruction execution time: 10 ns/7.5 ns/6.7 ns (at internal 100 mhz/133 mhz/150 mhz operation) { general-purpose registers: 32 bits 32 { instruction set: v850e1 cpu signed multiplication (16 bits 16 bits 32 bits or 32 bits 32 bits 64 bits): 1 to 2 clocks saturated operation instructions (with overflow/underflow detection function) 32-bit shift instructions: 1 clock bit manipulation instructions load/store instructions with long/short format signed load instructions { memory space: 256 mb linear address space (common program/data use) chip select output function: 8 spaces memory block division function: 2, 4, 6, 8, 64 mb/block programmable wait function idle state insertion function { external bus interface: 32-bit data bus (address/data separated) 32-/16-/8-bit bus sizing function external bus division function: 1/1, 1/2, 1/3, 1/4 (66 mhz max.) bus hold function external wait function address setup wait function endian control function { internal memory instruction ram: 128 kb data ram: 16 kb { instruction cache 8 kb 2-way set associative { interrupts/exceptions: external interrupts: 40 (including nmi) internal interrupts: 59 sources exceptions: 2 sources eight levels of priorities can be set. { memory access controller dram controller (compatible with sdram) page rom controller speculative read/write buffer function
chapter 1 introduction 30 preliminar y user?s manual u16031ej2v1ud { dma controller: 4 channels transfer unit: 8 bits/16 bits/32 bits maximum transfer count: 65,536 (2 16 ) transfer type: flyby (1-cycle)/2-cycle transfer mode: single/single step/block transfer target: memory ? memory, memory ? i/o transfer request: external request/on-chip peripheral i/o/ software dma transfer terminate (terminal count) output signal next address setting function { i/o lines: input ports: 1 i/o ports: 77 { real-time pulse unit: 16-bit timer/event counter: 6 channels (no capture operation for 2 channels) 16-bit timers: 6 16-bit capture/compare registers: 12 16-bit interval timer: 4 channels 16-bit up/down counter/timer for 2-phase encoder input: 2 channels 16-bit capture/compare registers: 4 16-bit compare registers: 4 { serial interfaces (sio): asynchronous serial interface b (uartb) clocked serial interface 3 (csi3) csi3/uartb: 1 channel uartb: 1 channel csi3: 1 channel usb function controller (usbf): 1 channel full speed (12 mbps) endpoint control transfer: 64 bytes 2 interrupt transfer: 8 bytes 2 bulk transfer (in): 64 bytes 2 banks 2 bulk transfer (out): 64 bytes 2 banks 2 { a/d converter: 10-bit resolution a/d converter: 8 channels { pwm (pulse width modulation): 16-bit resolution pwm: 2 channels { clock generator: 8 function using sscg { power-save function: halt/idle/software stop mode { package: 176-pin plastic lqfp (fine pitch) (24 24) { cmos technology: all static circuits
chapter 1 introduction 31 preliminar y user?s manual u16031ej2v1ud 1.3 applications servo control, nc machine tools, ink-jet printers, facsimiles, dvd players, video printers, ppc, information equipment, etc. 1.4 ordering information part number package maximum operating frequency pd703111gm-10-ueu 176-pin plastic lqfp (fine pitch) (24 24) 100 mhz pd703111gm-13-ueu 176-pin plastic lqfp (fine pitch) (24 24) 133 mhz pd703111gm-15-ueu 176-pin plastic lqfp (fine pitch) (24 24) 150 mhz
chapter 1 introduction 32 preliminar y user?s manual u16031ej2v1ud 1.5 pin configuration ? 176-pin plastic lqfp (fine pitch) (24 24) pd703111gm-10-ueu pd703111gm-13-ueu pd703111gm-15-ueu top view 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 trcdata3 pdh15/d31/intpd15/pwm1 pdh14/d30/intpd14/pwm0 ev ss ev dd pdh13/d29/intpd13/tiud11 pdh12/d28/intpd12/to11 pdh11/d27/intpd11/intp111/tclr11 pdh10/d26/intpd10/intp110/tcud11 pdh9/d25/intpd9/tiud10 pdh8/d24/intpd8/to10 pdh7/d23/intpd7/intp101/tclr10 pdh6/d22/intpd6/intp100/tcud10 pdh5/d21/intpd5/toc5 pdh4/d20/intpd4 pdh3/d19/intpd3 ev ss ev dd pdh2/d18/intpd2/toc4 pdh1/d17/intpd1 pdh0/d16/intpd0 d15 d14 d13 d12 d11 d10 d9 d8 iv ss iv dd ev ss ev dd d7 d6 d5 d4 d3 d2 d1 d0 sdcke/pcd0 ev ss ev dd 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 p72/dmarq2/intpc20/tic2 p73/dmaak2/intpc21 p74/tc2/toc2 p75/dmarq3/intpc30/tic3 p76/dmaak3/intpc31 p77/tc3/toc3 ssel0 ssel1 pllv ss pllv dd oscv ss x2 x1 oscv dd uv dd udm udp p10/uclk/intp10 iv ss iv dd pllsel p11/sck0/intp11 p12/rxd0/si0 p13/txd0/so0 p20/nmi ev ss ev dd p21/rxd1/intp21 p22/txd1/intp22 p23/sck1/intp23 p24/si1/intp24 p25/so1/intp25 dck dms drst ddi ddo trcclk trcend trcdata0 trcdata1 iv ss iv dd trcdata2 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 a25/pah9 a24/pah8 a23/pah7 a22/pah6 a21/pah5 a20/pah4 a19/pah3 a18/pah2 ev dd ev ss iv dd iv ss a17/pah1 a16/pah0 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 ev dd ev ss a4 a3 a2 intpl1/a1/pal1 intpl0/a0/pal0 bcyst/pct7 we/wr/pct5 rd/pct4 uudqm/uube/uuwr/pct3 pct2/ulwr/ulbe/uldqm pct1/luwr/lube/ludqm pct0/llwr/llbe/lldqm iv dd iv ss sdras/pcd3 sdcas/pcd2 busclk/pcd1 jit1 jit0 av dd av refp ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 av refm av ss mode1 mode0 intp67/toc1/p67 intp66/intpc11/p66 intp65/tic1/intpc10/p65 toc0/tc1/p55 intpc01/dmaak1/p54 intpc00/tic0/dmarq1/p53 intp52/tc0/p52 intp51/dmaak0/p51 intp50/dmarq0/p50 iv dd iv ss reset adtrg/selfref/pcm5 refrq/pcm4 hldrq/pcm3 hldak/pcm2 pcm1 wait/pcm0 cs7/pcs7 cs6/pcs6 iord/cs5/pcs5 ev dd ev ss cs4/pcs4 cs3/pcs3 iowr/cs2/pcs2 cs1/pcs1 cs0/pcs0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
chapter 1 introduction 33 preliminar y user ? s manual u16031ej2v1ud pin identification a0 to a25: address bus p72 to p77: port 7 adtrg: a/d trigger input pah0 to pah9: port ah ani0 to ani7: analog input pal0, pal1: port al av dd : analog power supply pcd0 to pcd3: port cd av refm : analog reference voltage pcm0 to pcm5: port cm av refp : analog reference voltage pcs0 to pcs7: port cs av ss : analog ground pct0 to pct5, pct7: port ct bcyst: bus cycle start timing pdh0 to pdh15: port dh busclk: bus clock output pllsel: pll operating mode select cs0 to cs7: chip select pllv dd : pll power supply d0 to d31: data bus pllv ss : pll ground dck: debug clock input pwm0, pwm1: pulse width modulation ddi: debug data input rd: read strobe ddo: debug data output refrq: refresh request drst: debug reset reset: reset dms: debug mode rxd0, rxd1: receive data dmaak0 to dmaak3: dma acknowledge sck0, sck1: serial clock dmarq0 to dmarq3: dma request sdcas: sdram column address strobe ev dd : power supply for external pins sdcke: sdram clock enable ev ss : ground for external pins sdras: sdram row address strobe hldak: hold acknowledge selfref: self-refresh request hldrq: hold request si0, si1: serial input intp10, intp11, : interrupt request from peripherals so0, so1: serial output intp21 to intp25, intp50 to intp52, ssel0, ssel1: clock generator operating mode select intp65 to intp67, tc0 to tc3: terminal count signal intp100, intp101, tclr10, tclr11: timer clear intp110, intp111, tcud10, tcud11: timer control pulse input intpc00, intpc01, tic0 to tic3: timer input intpc10, intpc11, tiud10, tiud11: timer count pulse input intpc20, intpc21, to10, to11, : timer output intpc30, intpc31, toc0 to toc5 intpd0 to intpd15 trcclk: trace clock intpl0, intpl1 trcdata0 to: trace data output iord: i/o read strobe trcdata3 iowr: i/o write strobe trcend: trace end status output iv dd : power supply for internal unit txd0, txd1: transmit data iv ss : ground for internal unit uclk: usb external clock input jit0, jit1: sscg jitter select udm: usb data input & output ( ? ) llbe: lower byte enable (d0 to d7) udp: usb data input & output (+) lldqm: lower dq mask enable (d0 to d7) ulbe: upper byte enable (d16 to d23) llwr: lower write strobe (d0 to d7) lube: lower byte enable (d8 to d15) uldqm: upper dq mask enable (d16 to d23) ludqm: lower dq mask enable (d8 to d15) ulwr: upper write strobe (d16 to d23) luwr: lower write strobe (d8 to d15) uube: upper byte enable (d24 to d31) mode0, mode1: mode nmi: non-maskable interrupt request uudqm: upper dq mask enable (d24 to d31) oscv dd : clock generator power supply uuwr: upper write strobe (d24 to d31) oscv ss : clock generator ground uv dd : power supply for usb unit p10 to p13: port 1 wait: wait p20 to p25: port 2 we: write enable p50 to p55: port 5 wr: write strobe output enable p65 to p67: port 6 x1, x2: crystal
chapter 1 introduction 34 preliminar y user ? s manual u16031ej2v1ud 1.6 function blocks 1.6.1 internal block diagram cpu 32-bit barrel shifter pc system registers general-purpose registers (32 bits 32) alu multiplier (32 32 64) ports p10 to p13 p20 p21 to p25 p50 to p55 p65 to p67 p72 to p77 pal0, pal1 pah0 to pah9 pcd0 to pcd3 pcm0 to pcm5 pcs0 to pcs7 pct0 to pct5, pct7 pdh0 to pdh15 adc usbf pwm system controller bcu instruction queue memc sram rom sdram dma si0/rxd0 so0/txd0 sck0 toc4, toc5 toc0 to toc3 tic0 to tic3 to10, to11 nmi drst, dck, dms, ddi wait hldrq hldak a0 to a25 d0 to d31 dmarq0 to dmarq3 dmaak0 to dmaak3 tc0 to tc3 cs0, cs1, cs3, cs4, cs6, cs7 cs2/iowr cs5/iord bcyst rd ani0 to ani7 adtrg av refp , av refm av dd av ss reset mode0, mode1 iv dd iv ss ev dd ev ss pwm0, pwm1 udp udm uclk uv dd xxwr/xxbe wr busclk sdcke sdras sdcas we xxdqm refrq selfref ddo, trcclk, trcdata0 to trcdata3 , trcend intp100, intp110 intp101, intp111 intp10, intp11 intp21 to intp25 intp50 to intp52 intp65 to intp67 intpd0 to intpd15 intpl0, intpl1 tclr10, tclr11 tiud10, tiud11 tcud10, tcud11 intpc00, intpc01, intpc10, intpc11, intpc20, intpc21, intpc30, intpc31 si1 so1 sck1 rxd1 txd1 ssel0, ssel1 jit0, jit1 pllsel x1 x2 oscv dd oscv ss pllv dd pllv ss tmc tmc tmenc1 intc dcu tmd csi30/uartb0 csi31 uartb1 cg 8 kb instruction cache 128 kb instruction ram 16 kb data ram bbr remark xx: ll, lu, ul, uu
chapter 1 introduction 35 preliminar y user ? s manual u16031ej2v1ud 1.6.2 on-chip units (1) cpu the cpu uses five-stage pipeline control to enable single-clock execution of address calculations, arithmetic logic operations, data transfers, and almost all other instruction processing. other dedicated on-chip hardware, such as a multiplier (16 bits 16 bits 32 bits or 32 bits 32 bits 64 bits) and a barrel shifter (32 bits), help accelerate processing of complex instructions. (2) bus control unit (bcu) the bcu starts the required external bus cycle based on the physical address obtained by the cpu. when an instruction is fetched from external memory area and the cpu does not send a bus cycle start request, the bcu generates a prefetch address and prefetches the instruction code. the prefetched instruction code is stored in an instruction queue in the cpu. the bcu controls a dram controller (dramc), page rom controller (romc), and dma controller (dmac) and performs external memory access and dma transfer. (a) sdram controller the sdram controller generates the sdras, sdcas, uudqm, uldqm, ludqm, and lldqm signals and performs access control for sdram. cas latency 1 (excluding flyby dma transfer), 2, and 3 are supported, and the burst length is fixed to 1. a refresh function that supports the cbr refresh cycle and a dynamic self-refresh function based on an external input are also available. (b) page rom controller (romc) this controller supports accessing rom that includes the page access function. it performs address comparisons with the immediately preceding bus cycle and executes wait control for normal access (off-page)/page access (on-page). it can handle page widths of 8 to 128 bytes. (c) dma controller (dmac) this controller controls data transfer between memory and i/o instead of the cpu. there are two address modes: flyby (1-cycle) transfer, and 2-cycle transfer. there are three bus modes, single transfer, single step transfer, and block transfer. (3) ram instruction ram (128 kb) and data ram (16 kb) are provided. the instruction ram can be accessed in one clock from the cpu when an instruction is fetched. its write access time depends on the busclk frequency to the cs0 space and the number of wait cycles. this ram is mapped from address 00000000h. the data ram can be accessed in one clock from the cpu when its data is read. it is mapped from address ffff8000h. (4) cache an instruction cache (8 kb) is provided.
chapter 1 introduction 36 preliminar y user ? s manual u16031ej2v1ud (5) interrupt controller (intc) this controller handles hardware interrupt requests (nmi, intpn) from on-chip peripheral i/o and external hardware. eight levels of interrupt priorities can be specified for these interrupt requests, and multiple- interrupt servicing control can be performed for interrupt sources (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, l1, c00, c01, c10, c11, c20, c21, c30, c31). (6) clock generator (cg) this clock generator supplies frequencies which are 8 times the input clock (f x ) (using an on-chip pll) as the internal system clock (f clk ). as the input clock, an external oscillator is input from pins x1 and x2. (7) real-time pulse unit (rpu) this unit incorporates a 6-channel 16-bit timer/event counter, 4-channel 16-bit interval timer, and 2-channel 16-bit up/down counter/timer for 2-phase encoder input and can measure pulse widths or frequency and output a programmable pulse. (8) serial interfaces (sio) the serial interfaces consist of 3 channels divided between an asynchronous serial interface b (uartb) and clocked serial interface 3 (csi3). of these 3 channels, one is alternative with uartb and csi3, one is fixed to csi3, and one is fixed to uartb. uartb transfers data by using the txdn and rxdn pins (n = 0, 1). csi3 transfers data by using the son, sin, and sckn pins (n = 0, 1). in addition, a usb function controller (usbf) is also provided. (9) a/d converter (adc) this high-speed, high-resolution 10-bit a/d converter includes 8 analog input pins. conversion is performed using the successive approximation method. (10) pwm two channels for pwm signal output of 16-bit resolution have been provided. by connecting an external low-pass filter, pwm output can be used as digital to analog conversion output. pwm is ideal for actuator control signals such as those in motors.
chapter 1 introduction 37 preliminar y user ? s manual u16031ej2v1ud (11) ports as shown below, the following ports have general-purpose port functions and control pin functions. port i/o control function port 1 4-bit i/o serial interface i/o, usb clock signal input, external interrupt input port 2 1-bit input, 5-bit i/o nmi input, serial interface i/o, external interrupt input port 5 6-bit i/o dma controller i/o, external interrupt input, real-time pulse unit i/o port 6 3-bit i/o real-time pulse unit i/o, external interrupt input port 7 6-bit i/o dma controller i/o, real-time pulse unit i/o, external interrupt input port al 2-bit i/o external address bus, external interrupt input port ah 10-bit i/o external address bus port dh 16-bit i/o external data bus, external interrupt input, pwm output, real-time pulse unit i/o port cs 8-bit i/o external bus interface control signal output port ct 7-bit i/o external bus interface control signal output port cm 6-bit i/o wait insertion signal input, external bus interface control signal i/o, self-refresh request signal input, a/d converter external trigger input port cd 4-bit i/o external bus interface control signal output, bus clock output
preliminary user?s manual u16031ej2v1ud 38 chapter 2 pin functions the names and functions of the pins in the v850e/me2 are listed below. these pins can be divided into port pins and non-port pins according to their functions. 2.1 list of pin functions (1) port pins (1/3) pin name i/o function alternate function p10 intp10/uclk p11 intp11/sck0 p12 si0/rxd0 p13 i/o port 1 4-bit i/o port input/output can be specified in 1-bit units. so0/txd0 p20 input nmi p21 intp21/rxd1 p22 intp22/txd1 p23 intp23/sck1 p24 intp24/si1 p25 i/o port 2 p20 is an input-only port. if a valid edge is input, it operates as an nmi input. also, the status of the nmi input is shown by bit 0 of the p2 register. p21 to p25 are a 5-bit i/o port. input/output can be specified in 1-bit units. intp25/so1 p50 intp50/dmarq0 p51 intp51/dmaak0 p52 intp52/tc0 p53 intpc00/tic0/dmarq1 p54 intpc01/dmaak1 p55 i/o port 5 6-bit i/o port input/output can be specified in 1-bit units. toc0/tc1 p65 intp65/intpc10/tic1 p66 intp66/intpc11 p67 i/o port 6 3-bit i/o port input/output can be specified in 1-bit units. intp67/toc1 p72 intpc20/tic2/dmarq2 p73 intpc21/dmaak2 p74 toc2/tc2 p75 intpc30/tic3/dmarq3 p76 intpc31/dmaak3 p77 i/o port 7 6-bit i/o port input/output can be specified in 1-bit units. toc3/tc3 pah0 to pah9 i/o port ah 8-/10-bit i/o port input/output can be specified in 1-bit units. a16 to a25
chapter 2 pin functions 39 preliminar y user?s manual u16031ej2v1ud (2/3) pin name i/o function alternate function pal0 intpl0/a0 pal1 i/o port al 2-bit i/o port input/output can be specified in 1-bit units. intpl1/a1 pdh0 d16/intpd0 pdh1 d17/intpd1 pdh2 d18/intpd2/toc4 pdh3 d19/intpd3 pdh4 d20/intpd4 pdh5 d21/intpd5/toc5 pdh6 d22/intpd6/intp100/tcud10 pdh7 d23/intpd7/intp101/tclr10 pdh8 d24/intpd8/to10 pdh9 d25/intpd9/tiud10 pdh10 d26/intpd10/intp110/tcud11 pdh11 d27/intpd11/intp111/tclr11 pdh12 d28/intpd12/to11 pdh13 d29/intpd13/tiud11 pdh14 d30/intpd14/pwm0 pdh15 i/o port dh 8-/16-bit i/o port input/output can be specified in 1-bit units. d31/intpd15/pwm1 pcd0 sdcke pcd1 busclk pcd2 sdcas pcd3 i/o port cd 4-bit i/o port input/output can be specified in 1-bit units. sdras pcm0 wait pcm1 ? pcm2 hldak pcm3 hldrq pcm4 refrq pcm5 i/o port cm 6-bit i/o port input/output can be specified in 1-bit units. adtrg/selfref pcs0 cs0 pcs1 cs1 pcs2 cs2/iowr pcs3 cs3 pcs4 cs4 pcs5 cs5/iord pcs6 cs6 pcs7 i/o port cs 8-bit i/o port input/output can be specified in 1-bit units. cs7
chapter 2 pin functions 40 preliminar y user?s manual u16031ej2v1ud (3/3) pin name i/o function alternate function pct0 llwr/llbe/lldqm pct1 luwr/lube/ludqm pct2 ulwr/ulbe/uldqm pct3 uuwr/uube/uudqm pct4 rd pct5 we/wr pct7 i/o port ct 7-bit i/o port input/output can be specified in 1-bit units. bcyst
chapter 2 pin functions 41 preliminar y user?s manual u16031ej2v1ud (2) non-port pins (1/5) pin name i/o function alternate function a0 pal0/intpl0 a1 pal1/intpl1 a2 to a9 ? a10 to a15 ? a16 to a25 output 26-bit address bus for external memory pah0 to pah9 adtrg input a/d converter external trigger input pcm5/selfref ani0 to ani7 input analog inputs to a/d converter ? av dd ? 3.3 v positive power supply for a/d converter ? av refm ? av refp input reference voltage applied to a/d converter ? av ss ? ground potential for a/d converter ? bcyst output strobe signal output that shows the start of the bus cycle pct7 busclk output clock output for sdram pcd1 cs0 pcs0 cs1 pcs1 cs2 pcs2/iowr cs3 pcs3 cs4 pcs4 cs5 pcs5/iord cs6 pcs6 cs7 output chip select signal output pcs7 d0 to d15 ? d16 pdh0/intpd0 d17 pdh1/intpd1 d18 pdh2/intpd2/toc4 d19 pdh3/intpd3 d20 pdh4/intpd4 d21 pdh5/intpd5/toc5 d22 pdh6/intpd6/intp100/tcud10 d23 pdh7/intpd7/intp101/tclr10 d24 pdh8/intpd8/to10 d25 pdh9/intpd9/tiud10 d26 pdh10/intpd10/intp110/tcud11 d27 pdh11/intpd11/intp111/tclr11 d28 pdh12/intpd12/to11 d29 pdh13/intpd13/tiud11 d30 pdh14/intpd14/pwm0 d31 i/o 32-bit data bus for external memory pdh15/intpd15/pwm1
chapter 2 pin functions 42 preliminar y user?s manual u16031ej2v1ud (2/5) pin name i/o function alternate function dck input debug clock input ? ddi input debug data input ? ddo output debug data output ? dmaak0 p51/intp51 dmaak1 p54/intpc01 dmaak2 p73/intpc21 dmaak3 output dma acknowledge signal output p76/intpc31 dmarq0 p50/intp50 dmarq1 p53/intpc00/tic0 dmarq2 p72/intpc20/tic2 dmarq3 input dma request signal input p75/intpc30/tic3 dms input debug mode select ? drst input reset input for debug ? ev dd ? 3.3 v positive power supply for external pin ? ev ss ? ground potential for external pin ? hldak output bus hold acknowledge output pcm2 hldrq input bus hold request input pcm3 intp10 p10/uclk intp11 p11/sck0 intp21 p21/rxd1 intp22 p22/txd1 intp23 p23/sck1 intp24 p24/si1 intp25 p25/so1 intp50 p50/dmarq0 intp51 p51/dmaak0 intp52 p52/tc0 intp65 p65/tic1/intpc10 intp66 p66/intpc11 intp67 p67/toc1 intpd0 pdh0/d16 intpd1 pdh1/d17 intpd2 pdh2/toc4/d18 intpd3 pdh3/d19 intpd4 pdh4/d20 intpd5 pdh5/toc5/d21 intpd6 pdh6/intp100/tcud10/d22 intpd7 pdh7/intp101/tclr10/d23 intpd8 pdh8/to10/d24 intpd9 pdh9/tiud10/d25 intpd10 input external maskable interrupt request input pdh10/intp110/tcud11/d26
chapter 2 pin functions 43 preliminar y user?s manual u16031ej2v1ud (3/5) pin name i/o function alternate function intpd11 pdh11/intp111/tclr11/d27 intpd12 pdh12/to11/d28 intpd13 pdh13/tiud11/d29 intpd14 pdh14/pwm0/d30 intpd15 pdh15/pwm1/d31 intpl0 pal0/a0 intpl1 input external maskable interrupt request input pal1/a1 intp100 pdh6/tcud10/d22/intpd6 intp101 input timer enc10 external capture trigger input pdh7/tclr10/d23/intpd7 intp110 pdh10/tcud11/d26/intpd10 intp111 input timer enc11 external capture trigger input pdh11/tclr11/d27/intpd11 intpc00 p53/tic0/dmarq1 intpc01 external maskable interrupt request input/timer c0 external capture trigger input p54/dmaak1 intpc10 p65/intp65/tic1 intpc11 external maskable interrupt request input/timer c1 external capture trigger input p66/intp66 intpc20 p72/tic2/dmarq2 intpc21 external maskable interrupt request input/timer c2 external capture trigger input p73/dmaak2 intpc30 p75/tic3/dmarq3 intpc31 input external maskable interrupt request input/timer c3 external capture trigger input p76/dmaak3 iord output dma read strobe signal output pcs5/cs5 iowr output dma write strobe signal output pcs2/cs2 iv dd 1.5 v positive power supply for internal unit ? iv ss ? ground potential for internal unit ? jit0 ? jit1 input specifying sscg operating mode ? llbe output external data bus byte enable signal output (lowest byte (d0 to d7)) pct0/lldqm/llwr lldqm output output disable/write mask signal output for sdram (lowest byte (d0 to d7)) pct0/llwr/llbe llwr output external data bus write strobe signal output (lowest byte (d0 to d7)) pct0/llbe/lldqm lube output external data bus byte enable signal output (third byte (d8 to d15)) pct1/ludqm/luwr ludqm output output disable/write mask signal output for sdram (third byte (d8 to d15)) pct1/luwr/lube luwr output external data bus write strobe signal output (third byte (d8 to d15)) pct1/lube/ludqm mode0 ? mode1 input specifying v850e/me2 operating mode ? nmi input non-maskable interrupt request signal input p20 oscv dd 3.3 v positive power supply for oscillator ? oscv ss ? ground potential for oscillator ? pllsel input input specifying pll operating mode ?
chapter 2 pin functions 44 preliminar y user?s manual u16031ej2v1ud (4/5) pin name i/o function alternate function pllv dd 1.5 v positive power supply for pll synthesizer ? pllv ss ? ground potential for pll synthesizer ? pwm0 pdh14/d30/intpd14 pwm1 output pwm pulse signal output pdh15/d31/intpd15 rd output external data bus read strobe signal output pct4 refrq output refresh request signal output for sdram pcm4 reset input system reset input ? rxd0 p12/si0 rxd1 input uartb0 and uartb1 serial receive data input p21/intp21 sck0 p11/intp11 sck1 i/o csi30 and csi31 serial clock i/o (3-wire) p23/intp23 sdcas output column address strobe signal output for sdram pcd2 sdcke output sdram clock enable signal output pcd0 sdras output row address strobe signal output for sdram pcd3 selfref input self-refresh request input for sdram pcm5/adtrg si0 p12/rxd0 si1 input csi30 and csi31 serial receive data input (3-wire) p24/intp24 so0 p13/txd0 so1 output csi30 and csi31 serial transmit data output (3-wire) p25/intp25 ssel0 ? ssel1 input specifying the clock generator?s operating mode ? tc0 p52/intp52 tc1 p55/toc0 tc2 p74/toc2 tc3 output dma transfer end (terminal count) signal output p77/toc3 tclr10 pdh7/d23/intpd7/intp101 tclr11 input clear signal input to timer enc10 and enc11 pdh11/d27/intpd11/intp111 tcud10 pdh6/d22/intpd6/intp100 tcud11 input count operation switching signal input to timer enc10 and enc11 pdh10/d26/intpd10/intp110 tic0 p53/dmarq1/intpc00 tic1 p65/intp65/intpc10 tic2 p72/intpc20/dmarq2 tic3 input external count clock input of timer c0 to c3 p75/intpc30/dmarq3 tiud10 pdh9/d25/intpd9 tiud11 input external count clock input to timer enc10 and enc11 pdh13/d29/intpd13 to10 pdh8/d24/intpd8 to11 output pulse signal output of timer enc10 and enc11 pdh12/d28/intpd12
chapter 2 pin functions 45 preliminar y user?s manual u16031ej2v1ud (5/5) pin name i/o function alternate function toc0 p55/tc1 toc1 p67/intp67 toc2 p74/tc2 toc3 p77/tc3 toc4 pdh2/d18/intpd2 toc5 output pulse signal output of timer c0 to c5 pdh5/d21/intpd5 trcclk output trace clock output ? trcdata0 output ? trcdata1 output ? trcdata2 output ? trcdata3 output trace data output (d0 to d3) ? trcend output trace end status output ? txd0 p13/so0 txd1 output uartb0 and uartb1 serial transmit data output p22/intp22 uclk note input usb clock signal input p10/intp10 udm i/o usb data i/o ( ? ) ? udp i/o usb data i/o (+) ? ulbe output external data bus byte enable signal output (second byte (d16 to d23)) pct2/uldqm/ulwr uldqm output output disable/write mask signal output for sdram (second byte (d16 to d23)) pct2/ulwr/ulbe ulwr output external data bus write strobe signal output (second byte (d16 to d23)) pct2/ulbe/uldqm uube output external data bus byte enable signal output (highest byte (d24 to d31)) pct3/uuwr/uudqm uudqm output output disable/write mask signal output for sdram (highest byte (d24 to d31)) pct3/uuwr/uube uuwr output external data bus write strobe signal output (highest byte (d24 to d31)) pct3/uudqm/uube uv dd ? 3.3 v positive power supply for usb ? wait input control signal input that inserts a wait in the bus cycle pcm0 we output write enable signal output for sdram pct5/wr wr output write strobe signal output for sdram pct5/we x1 input ? x2 ? connects the crystal resonator for system clock oscillation. in the case of an external source supplying the clock, it is input to x1. ? note when using as the uclk pin, be careful to avoid the input of a staircase waveform due to reflection, etc., or the input of noise.
chapter 2 pin functions 46 preliminar y user?s manual u16031ej2v1ud 2.2 pin status the status of each pin after reset, in power-save mode (software stop, idle, halt modes), and during dma transfer, refresh, and bus hold (th) is shown below. operating status pin reset idle mode/software stop mode halt mode/during dma transfer, refresh bus hold (th) note 1 a0 to a1 (pal0 to pal1) hi-z hi-z operating hi-z a2 to a15 hi-z hi-z operating hi-z a16 to a25 (pah0 to pah9) hi-z hi-z operating hi-z d0 to d15 hi-z hi-z operating hi-z d16 to d31 (pdh to pdh15) hi-z hi-z operating hi-z cs0 to cs7 (pcs0 to pcs7) hi-z h operating hi-z iowr (pcs2) h operating hi-z iord (pcs5) h operating hi-z llwr, luwr, ulwr, uuwr (pct0 to pct3) hi-z h operating hi-z llbe, lube, ulbe, uube (pct0 to pct3) h operating hi-z lldqm, ludqm, uldqm, uudqm (pct0 to pct3) h operating hi-z rd (pct4) hi-z h operating hi-z wr (pct5) hi-z h operating hi-z we (pct5) h operating hi-z bcyst (pct7) hi-z h operating hi-z wait (pcm0) hi-z ? operating ? hldak (pcm2) hi-z h operating l hldrq (pcm3) hi-z ? operating operating refrq (pcm4) hi-z operating note 2 operating operating selfref (pcm5) hi-z ? operating operating sdcke (pcd0) hi-z l note 2 operating operating busclk (pcd1) operating l operating operating sdcas (pcd2) hi-z self operating hi-z sdras (pcd3) hi-z self operating hi-z dmaak0 (p51) h operating h dmaak1 (p54) h operating h dmaak2 (p73) h operating h dmaak3 (p76) h operating h peripheral function input pin other than above ? operating operating peripheral function output pin other than above hold operating operating port input pin other than above hi-z ?? operating port output pin other than above hold hold operating remark explanation on note and remark are given on the next page.
chapter 2 pin functions 47 preliminar y user?s manual u16031ej2v1ud notes 1. the pin set in the port mode holds the status immediately before. 2. high-level output when the sdram controller is not used remark hi-z: high-impedance h: high-level output l: low-level output ? : no sampling of input : no select function at reset self: self-refresh state when pins are connected to sdram notes on turning on/off power the v850e/me2 has two power supply pins: a power supply pin for internal units (iv dd ) and a power supply pin for external pins (ev dd ). the i/o status of an alternate-function i/o pin may be undefined outside the range in which the operation is guaranteed. if this undefined i/o status affects the system, the pin can be made to go into a high-impedance state using the following measure. ? ? ? ? when turning on power keep the voltage on the ev dd pin at 0 v until the voltage on the iv dd pin reaches the operation guaranteed range (1.35 to 1.65 v). ? ? ? ? when turning off power keep the voltage on the iv dd pin to within the operation guaranteed range (1.35 to 1.65 v) until the voltage on the ev dd pin drops to 0 v. 1.35 v 0 v 0 v iv dd ev dd reset (input) 1.35 v oscillation stabilization time
chapter 2 pin functions 48 preliminar y user ? s manual u16031ej2v1ud 2.3 description of pin functions (1) p10 to p13 (port 1) 3-state i/o p10 to p13 function as a 4-bit i/o port that can be set to input or output in 1-bit units. besides functioning as an i/o port, in the control mode, these pins operate as serial interface i/o (uartb0, csi30), usb clock signal input, and external interrupt request input. the operation mode can be set to port or control mode in 1-bit units, specified by the port 1 mode control register (pmc1). (a) port mode p10 to p13 can be set to input or output in 1-bit units using the port 1 mode register (pm1). (b) control mode p10 to p13 can be set to port/control mode in 1-bit units using the pmc1 register. (i) intp10, intp11 (interrupt request from peripherals) input these are external interrupt request input pins. (ii) so0 (serial output) output this is a serial transmit data output pin of csi30. (iii) si0 (serial input) input this is a serial receive data input pin of csi30. (iv) sck0 (serial clock) 3-state i/o this is a csi30 serial clock i/o pin. (v) txd0 (transmit data) output this is a serial transmit data output pin of uartb0. (vi) rxd0 (receive data) input this is a serial receive data input pin of uartb0. (vii) uclk (usb clock) input this is a clock input pin of the usb. when using as the uclk pin, be careful to avoid the input of a staircase waveform due to reflection, etc., or the input of noise.
chapter 2 pin functions 49 preliminar y user ? s manual u16031ej2v1ud (2) p20 to p25 (port 2) 3-state i/o p20 is an input-only pin. p21 to p25 function as a 5-bit i/o port that can be set to input or output in 1-bit units. besides functioning as an i/o port, in the control mode, these pins operate as serial interface i/o (uartb1/csi31) and external interrupt request input. the operation mode can be set to port or control mode in 1-bit units, specified by the port 2 mode control register (pmc2). (a) port mode p21 to p25 can be set to input or output in 1-bit units using the port 2 mode register (pm2). p20 is an input-only port, and if a valid edge is input, it operates as an nmi input. (b) control mode p21 to p25 can be set to port/control mode in 1-bit units using the pmc2 register. (i) nmi (non-maskable interrupt request) input this is the non-maskable interrupt request input pin. (ii) intp21 to intp25 (interrupt request from peripherals) input these are external interrupt request input pins. (iii) so1 (serial output) output this is a serial transmit data output pin of csi31. (iv) si1 (serial input) input this is a serial receive data input pin of csi31. (v) sck1 (serial clock) 3-state i/o this is a csi31 serial clock i/o pin. (vi) txd1 (transmit data) output this is a serial transmit data output pin of uartb1. (vii) rxd1 (receive data) input this is a serial receive data input pin of uartb1.
chapter 2 pin functions 50 preliminar y user?s manual u16031ej2v1ud (3) p50 to p55 (port 5) 3-state i/o p50 to p55 function as a 6-bit i/o port that can be set to input or output in 1-bit units. besides functioning as an i/o port, in the control mode, these pins operate as dma request input, dma acknowledge output, dma transfer termination output (terminal count), real-time pulse unit (rpu) i/o, and external interrupt request input. the operation mode can be set to port or control mode in 1-bit units, specified by the port 5 mode control register (pmc5). (a) port mode p50 to p55 can be set to input or output in 1-bit units using the port 5 mode register (pm5). (b) control mode p50 to p55 can be set to port/control mode in 1-bit units using the pmc5 register. (i) dmarq0, dmarq1 (dma request) input these are dma service request signal input pins. they correspond to dma channels 0 and 1, respectively, and operate independently of each other. the priority order is fixed to dmarq0 > dmarq1 > dmarq2 > dmarq3. these signals are sampled at the rising edge of the busclk signal. maintain an active level until a dma request is acknowledged. (ii) dmaak0, dmaak1 (dma acknowledge) output these are acknowledge signal output pins that show a dma service request was granted. they correspond to dma channels 0 and 1, respectively, and operate independently of each other. in flyby transfer, these signals become active when external memory is being accessed and internal instruction ram (in the write mode) is being accessed. when dma transfers are being executed between internal data ram, internal instruction ram (in the read mode), and on-chip peripheral i/o, they do not become active. in 2-cycle transfer, these are used as the signals to control the dmarq0 and dmarq1 signals. (iii) tc0, tc1 (terminal count) output these are terminal count signal output pins that show that the dma transfer from the dma controller is complete. these pins correspond to dma channels 0 and 1 respectively, and operate independently of each other. the terminal count signals of dma channels 0 to 3 can be commonly output from the tc0 pin. these signals become active for 1 clock at the rising edge of the busclk signal. (iv) intpc00, intpc01 (interrupt request from peripherals) input these are external interrupt request input pins and the external capture trigger input pins of timer c0. (v) tic0 (timer input) input this is an external count clock input pin of timer c0. (vi) toc0 (timer output) output this is a pulse signal output pin of timer c0. (vii) intp50 to intp52 (interrupt request from peripherals) input these are external interrupt request input pins.
chapter 2 pin functions 51 preliminar y user ? s manual u16031ej2v1ud (4) p65 to p67 (port 6) 3-state i/o p65 to p67 function as a 3-bit i/o port that can be set to input or output in 1-bit units. besides functioning as an i/o port, in the control mode, these pins operate as real-time pulse unit (rpu) i/o and external interrupt request input. the operation mode can be set to port or control mode in 1-bit units, specified by the port 6 mode control register (pmc6). (a) port mode p65 to p67 can be set to input or output in 1-bit units using the port 6 mode register (pm6). (b) control mode p65 to p67 can be set to port/control mode in 1-bit units using the pmc6 register. (i) tic1 (timer input) input this is the external count clock input pin for timer c1. (ii) toc1 (timer output) output this is the pulse signal output pin for timer c1. (iii) intp65 to intp67 (interrupt request from peripherals) input these are external interrupt request input pins. (iv) intpc10, intpc11 (interrupt request from peripherals) input these are external interrupt request input pins and the external capture trigger input pins of timer c1.
chapter 2 pin functions 52 preliminar y user ? s manual u16031ej2v1ud (5) p72 to p77 (port 7) 3-state i/o p72 to p77 function as a 6-bit i/o port that can be set to input or output in 1-bit units. besides functioning as an i/o port, in the control mode, these pins operate as dma request input, dma acknowledge output, dma transfer termination output (terminal count), real-time pulse unit (rpu) i/o, and external interrupt request input. the operation mode can be set to port or control mode in 1-bit units, specified by the port 7 mode control register (pmc7). (a) port mode p72 to p77 can be set to input or output in 1-bit units using the port 7 mode register (pm7). (b) control mode p72 to p77 can be set to port/control mode in 1-bit units using the pmc7 register. (i) dmarq2, dmarq3 (dma request) input these are dma service request signal input pins. they correspond to dma channels 2 and 3, respectively, and operate independently of each other. the priority order is fixed to dmarq0 > dmarq1 > dmarq2 > dmarq3. these signals are sampled at the rising edge of the busclk signal. maintain an active level until a dma request is acknowledged. (ii) dmaak2, dmaak3 (dma acknowledge) output these are acknowledge signal output pins that show a dma service request was granted. they correspond to dma channels 2 and 3, respectively, and operate independently of each other. in flyby transfer, these signals become active only when external memory is being accessed and internal instruction ram (in the write mode) is being accessed. when dma transfers are being executed between internal data ram, internal instruction ram (in the read mode), and on-chip peripheral i/o, they do not become active. in 2-cycle transfer, these are used as the signals to control the dmarq2 and dmarq3 signals. (iii) tc2, tc3 (terminal count) output these are terminal count signal output pins that show that dma transfer from the dma controller is complete. these pins correspond to dma channels 2 and 3 respectively, and operate independently of each other. the terminal count signals of dma channels 0 to 3 can be commonly output from the tc0 pin. these signals become active for 1 clock at the rising edge of the busclk signal. (iv) intpc20, intpc21, intpc30, intpc31 (interrupt request from peripherals) input these are external interrupt request input pins and the external capture trigger input pins of timers c2 and c3. (v) tic2, tic3 (timer input) input these are external count clock input pins of timers c2 and c3. (vi) toc2, toc3 (timer output) output these are pulse signal output pins of timers c2 and c3.
chapter 2 pin functions 53 preliminar y user ? s manual u16031ej2v1ud (6) pcm0 to pcm5 (port cm) 3-state i/o pcm0 to pcm5 function as a 6-bit i/o port that can be set to input or output in 1-bit units. besides functioning as a port, in the control mode, these pins operate as wait insertion signal input, bus hold control signal, refresh request signal output for sdram, self-refresh request signal input, and a/d converter external trigger input. the operation mode can be set to port or control in 1-bit units, specified by the port cm mode control register (pmccm). (a) port mode pcm0 to pcm5 can be set to input or output in 1-bit units using the port cm mode register (pmcm). (b) control mode pcm0 to pcm5 can be set to port/control mode in 1-bit units using the pmccm register. (i) wait (wait) input this is the control signal input pin at which a data wait is inserted in the bus cycle. the wait signal can be input asynchronously to the busclk signal. when the busclk signal falls, sampling is executed. when the set/hold time is not terminated within the sampling timing, wait insertion may not be executed. (ii) hldak (hold acknowledge) output this is the acknowledge signal output pin that indicates the high impedance status for the address bus, data bus, and control bus when the v850e/me2 receives a bus hold request. while this signal is active, the impedance of the address bus, data bus, and control bus becomes high and the bus mastership is transferred to the external bus master. (iii) hldrq (hold request) input this is the input pin through which an external device requests the v850e/me2 to release the address bus, data bus, and control bus. the hldrq signal can be input asynchronously to the busclk signal. when this pin is active, the address bus, data bus, and control bus are set to the high impedance status. this occurs either when the v850e/me2 completes execution of the current bus cycle or immediately if no bus cycle is being executed, then the hldak signal is set as active and the bus is released. in order to make the bus hold state secure, keep the hldrq signal active until the hldak signal is output. (iv) refrq (refresh request) output this is the refresh request signal output pin for sdram. in cases when the address is decoded by an external circuit to increase the connected sdram, or in cases when external simm ? s are connected, this signal is used for ras control during the refresh cycle. this signal becomes active during the refresh cycle. also, during bus hold, it becomes active when a refresh request is generated and informs the external bus master that a refresh request was generated.
chapter 2 pin functions 54 preliminar y user ? s manual u16031ej2v1ud (v) selfref (self refresh request) input this is a self-refresh request signal input pin for sdram. the internal data ram and internal instruction ram (in the read mode) can be accessed even in the self-refresh cycle. however, access to a peripheral i/o register or external device is held pending until the self-refresh cycle is cancelled. caution input to the selfref pin becomes valid immediately after the reset signal has been cleared. consequently, if a low level is input to the selfref pin by an external pull-down resistor, self refreshing is started. note that, at this time, the normal instruction fetch cycle does not occur. (vi) adtrg (a/d trigger input) input this is an external trigger input pin of the a/d converter.
chapter 2 pin functions 55 preliminar y user ? s manual u16031ej2v1ud (7) pct0 to pct5, pct7 (port ct) 3-state i/o pct0 to pct5 and pct7 function as a 7-bit i/o port that can be set to input or output in 1-bit units. besides functioning as a port, in the control mode, these pins operate as control signal outputs for when memory is expanded externally. the operation mode can be set to port or control mode in 1-bit units, specified by the port ct mode control register (pmcct). (a) port mode pct0 to pct5 and pct7 can be set to input or output in 1-bit units using the port ct mode register (pmct). (b) control mode pct0 to pct5 and pct7 can be set to port/control mode in 1-bit units using the pmcct register. (i) llwr (lower lower byte write strobe) 3-state output this is a strobe signal output pin that shows whether the bus cycle currently being executed is a write cycle for the sram, external rom, or external peripheral i/o area. for the data bus, the lowest byte (d0 to d7) becomes valid. if the bus cycle is a lowest memory write, it becomes active at the falling edge of the busclk signal in the t1 state and becomes inactive at the falling edge of the busclk signal in the t2 state. (ii) luwr (lower upper byte write strobe) 3-state output this is a strobe signal output pin that shows whether the bus cycle currently being executed is a write cycle for the sram, external rom, or external peripheral i/o area. for the data bus, the third byte (d8 to d15) becomes valid. if the bus cycle is a third byte memory write, it becomes active at the falling edge of the busclk signal in the t1 state and becomes inactive at the falling edge of the busclk signal in the t2 state. (iii) ulwr (upper lower byte write strobe) 3-state output this is a strobe signal output pin that shows whether the bus cycle currently being executed is a write cycle for the sram, external rom, or external peripheral i/o area. for the data bus, the second byte (d16 to d23) becomes valid. if the bus cycle is a second byte memory write, it becomes active at the falling edge of the busclk signal in the t1 state and becomes inactive at the falling edge of the busclk signal in the t2 state. (iv) uuwr (upper upper byte write strobe) 3-state output this is a strobe signal output pin that shows whether the bus cycle currently being executed is a write cycle for the sram, external rom, or external peripheral i/o area. for the data bus, the highest byte (d24 to d31) becomes valid. if the bus cycle is a highest memory write, it becomes active at the falling edge of the busclk signal in the t1 state and becomes inactive at the falling edge of the busclk signal in the t2 state. (v) llbe (lower lower byte enable) 3-state output this is a signal output pin that enables the lowest byte (d0 to d7) of the external data bus. (vi) lube (lower upper byte enable) 3-state output this is a signal output pin that enables the third byte (d8 to d15) of the external data bus.
chapter 2 pin functions 56 preliminar y user ? s manual u16031ej2v1ud (vii) ulbe (upper lower byte enable) 3-state output this is a signal output pin that enables the second byte (d16 to d23) of the external data bus. (viii) uube (upper upper byte enable) 3-state output this is a signal output pin that enables the highest byte (d24 to d31) of the external data bus. (ix) lldqm (lower lower dq mask enable) 3-state output this is a control signal output pin for the data bus to sdram. for the data bus, the lowest byte (d0 to d7) is valid. this signal carries out sdram output disable control during a read operation, and sdram byte mask control during a write operation. (x) ludqm (lower upper dq mask enable) 3-state output this is a control signal output pin for the data bus to sdram. for the data bus, the third byte (d8 to d15) is valid. this signal carries out sdram output disable control during a read operation, and sdram byte mask control during a write operation. (xi) uldqm (upper lower dq mask enable) 3-state output this is a control signal output pin for the data bus to sdram. for the data bus, the second byte (d16 to d23) is valid. this signal carries out sdram output disable control during a read operation, and sdram byte mask control during a write operation. (xii) uudqm (upper upper dq mask enable) 3-state output this is a control signal output pin for the data bus to sdram. for the data bus, the highest byte (d24 to d31) is valid. this signal carries out sdram output disable control during a read operation, and sdram byte mask control during a write operation. (xiii) rd (read strobe) 3-state output this is a strobe signal output pin that shows the bus cycle currently being executed is a read cycle for the sram, external rom, external peripheral i/o, or page rom area. in the idle state (ti), it becomes inactive. (xiv) wr (write strobe) 3-state output this is a strobe signal output pin that shows the bus cycle currently being executed is a write cycle for the sram, external rom, or external peripheral i/o area. it becomes active at the falling edge of the busclk signal in the t1 state and becomes inactive at the falling edge of the busclk signal in the t2 state. (xv) we (write enable) 3-state output this is a enable signal output pin that shows the bus cycle currently being executed is a write cycle for the sdram area. in the idle state (ti), it becomes inactive. (xvi) bcyst (bus cycle start timing) 3-state output this is a status signal output pin that shows the start of the bus cycle. it becomes active for 1-clock cycle from the start of each cycle. in the idle state (ti), it becomes inactive.
chapter 2 pin functions 57 preliminar y user ? s manual u16031ej2v1ud (8) pcs0 to pcs7 (port cs) 3-state i/o pcs0 to pcs7 function as an 8-bit i/o port that can be set to input or output in 1-bit units. besides functioning as a port, in the control mode, these pins operate as control signal outputs for when memory and peripheral i/o are expanded externally. the operation mode can be set to port or control mode in 1-bit units, specified by the port cs mode control register (pmccs). (a) port mode pcs0 to pcs7 can be set to input or output in 1-bit units using the port cs mode register (pmcs). (b) control mode pcs0 to pcs7 can be set to port/control mode in 1-bit units using the pmccs register. (i) cs0 to cs7 (chip select) 3-state output these are the chip select signal output pins for the sram, external rom, external peripheral i/o, and page rom area. the csn signal is assigned to memory block n (n = 0 to 7). it becomes active while the bus cycle that accesses the corresponding memory block is activated. in the idle state (ti), it becomes inactive. (ii) iowr (i/o write) 3-state output this is a write strobe signal output pin for external i/o during dma flyby transfer. it indicates whether the bus cycle currently being executed is a write cycle for external i/o during dma flyby transfer, or a write cycle for the sram area. note that if the ioen bit of the bus cycle period control register (bcp) is set (1), this signal can be output even in the normal sram, external rom, or external i/o cycle. (iii) iord (i/o read) 3-state output this is a read strobe signal output pin for external i/o during dma flyby transfer. it indicates whether the bus cycle currently being executed is a read cycle for external i/o during dma flyby transfer, or a read cycle for the sram area. note that if the ioen bit of the bcp register is set (1), this signal can be output even in the normal sram, external rom, or external i/o cycle.
chapter 2 pin functions 58 preliminar y user?s manual u16031ej2v1ud (9) pcd0 to pcd3 (port cd) 3-state i/o pcd0 to pcd3 function as a 4-bit i/o port that can be set to input or output in 1-bit units. besides functioning as a port, in control mode, these pins operate as control signal outputs for when the memory and peripheral i/o are expanded externally. the operation mode can be set to port or control mode in 1-bit units, specified by the port cd mode control register (pmccd). (a) port mode pcd0 to pcd3 can be set to input or output in 1-bit units using the port cd mode register (pmcd). (b) control mode pcd0 to pcd3 can be set to port or control mode in 1-bit units using the pmccd register. (i) sdcke (sdram clock enable) output this is the sdram clock enable output signal. it becomes inactive in self-refresh and standby mode. (ii) busclk (clock output) output this is a clock output pin for sdram. (iii) sdcas (sdram column address strobe) 3-state output this is a command output signal for sdram. (iv) sdras (sdram row address strobe) 3-state output this is a command output signal for sdram. (10) pah0 to pah9 (port ah) 3-state i/o pah0 to pah9 function as an 8- or 10-bit i/o port that can be set to input or output in 1-bit units. besides functioning as a port, in control mode, these pins operate as an address bus (a16 to a25) for when the memory is expanded externally. the operation mode can be set to port or control mode in 1-bit units, specified by the port ah mode control register (pmcah). (a) port mode pah0 to pah9 can be set to input or output in 1-bit units using the port ah mode register (pmah). (b) control mode pah0 to pah9 can be set to function alternately as a16 to a25 using the pmcah register. (i) a16 to a25 (address) 3-state output these are the address output pins of the higher 10 bits of the address bus?s 26-bit address when the external memory is accessed. the output changes in synchronization with the fall of the busclk signal in the t1 state. in the idle state (ti), the address of the bus cycle immediately before is retained.
chapter 2 pin functions 59 preliminar y user ? s manual u16031ej2v1ud (11) pal0, pal1 (port al) 3-state i/o pal0 and pal1 function as a 2-bit i/o port that can be set to input or output in 1-bit units. besides functioning as a port, in control mode, these pins operate as an address bus (a0, a1) and external interrupt request input for when the memory is expanded externally. the operation mode can be set to port or control mode in 1-bit units, specified by the port al mode control register (pmcal). (a) port mode pal0 and pal1 can be set to input or output in 1-bit units using the port al mode register (pmal). (b) control mode pal0 and pal1 can be set to port or control mode in 1-bit units using the pmcal register. (i) a0, a1 (address) 3-state output these are the address output pins of the lower 2 bits of the address bus ? s 26-bit address when the external memory is accessed. the output changes in synchronization with the fall of the busclk signal in the t1 state. in the idle state (ti), the address of the bus cycle immediately before is retained. (ii) intpl0, intpl1 (interrupt request from peripherals) input these are external interrupt request input pins.
chapter 2 pin functions 60 preliminar y user ? s manual u16031ej2v1ud (12) pdh0 to pdh15 (port dh) 3-state i/o pdh0 to pdh15 function as an 8- or 16-bit i/o port that can be set to input or output in 1-bit units. besides functioning as a port, in control mode, these pins operate as real-time pulse unit (rpu) i/o, pwm output, data bus (d16 to d31), and external interrupt request input. the operation mode can be set to port or control mode in 1-bit units, specified by the port dh mode control register (pmcdh). (a) port mode pdh0 to pdh15 can be set to input or output in 1-bit units using the port dh mode register (pmdh). (b) control mode pdh0 to pdh15 can be set to port or control mode in 1-bit units using the pmcdh register. (i) intpd0 to intpd15 (interrupt request from peripherals) input these are external interrupt request input pins. (ii) toc4, toc5 (timer output) output these are pulse signal output pins of timers c4 and c5. (iii) intp100, intp101, intp110, intp111 (timer capture trigger input) input these are external capture trigger input pins of timers enc10 and enc11. (iv) tiud10, tiud11 (timer count pulse input) input these are external count clock input pins of timers enc10 and enc11. (v) tcud10, tcud11 (timer control pulse input) input these are external count clock input pins of timers enc10 and enc11. (vi) tclr10, tclr11 (timer clear) input these are clear signal input pins of timers enc10 and enc11. (vii) to10, to11 (timer output) output these are pulse signal output pins of timers enc10 and enc11. (viii) pwm0, pwm1 (pulse width modulation) output these pins output the pwm pulse signal. (ix) d16 to d31 (data) 3-state i/o these pins constitute a data bus for when the external memory is accessed. these are the higher 16-bit i/o bus pins of the 32-bit data. the output changes in synchronization with the rise of the busclk signal in the t1 state. (13) pllsel (pll operating mode select) input this is an input pin used to specify the pll operating mode. (14) pllv dd (pll power supply) this is an 1.5 v positive power supply pin for pll synthesizer.
chapter 2 pin functions 61 preliminar y user ? s manual u16031ej2v1ud (15) pllv ss (pll ground) this is a ground pin for pll synthesizer. (16) ssel0, ssel1 (clock generator operating mode select) input these are input pins used to specify the clock generator ? s operating mode. (17) jit0, jit1 (sscg (spread spectrum frequency synthesizer phase locked loop) clock generator operating mode select) input these are input pins used to specify the sscg operating mode. (18) dck (debug clock) input this pin inputs a debug clock. at the rising edge of the dck signal, the dms and ddi signals are sampled, and data is output from the ddo pin at the falling edge of the dck signal. keep this pin high when the debug function is not used. (19) ddi (debug data input) input this pin inputs debug data. this pin is sampled at the rising edge of the dck signal when the debug serial interface is in the shift state. data is input with the lsb first. keep this pin high when the debug function is not used. (20) ddo (debug data output) 3-state output this pin outputs debug data. it outputs data at the falling edge of the dck signal when the debug serial interface is in the shift state. data is output with the lsb first. (21) dms (debug mode select) input this input pin selects a debug mode. depending on the level of the dms signal, the state machine of the debug serial interface changes. this pin is sampled at the rising edge of the dck signal. keep this pin high when the debug function is not used. (22) drst (debug reset) input this pin inputs a debug reset signal that is a negative-logic signal to initialize the dcu asynchronously. when this signal goes low, the dcu is reset/invalidated. keep this pin low when the debug function is not used. (23) mode0, mode1 (mode) input these are input pins used to specify the operating mode. (24) reset (reset) input reset is a signal that is input asynchronously and that has a constant low level width regardless of the operating clock ? s status. when this signal is input, a system reset is executed as the first priority ahead of all other operations. in addition to being used for ordinary initialization/start operations, this pin can also be used to release a standby mode (halt, idle, or software stop). (25) x1, x2 (crystal) these pins are used to connect the resonator that generates the system clock.
chapter 2 pin functions 62 preliminar y user?s manual u16031ej2v1ud (26) ani0 to ani7 (analog input) input these are analog input pins for the a/d converter. connect a capacitor between these pins and av ss to prevent noise-related operation faults. also, do not apply voltage that is outside the range for av ss and av dd to pins that are being used as inputs for the a/d converter. if it is possible for noise above the av dd range or below the av ss to enter, clamp these pins using a diode that has a small v f value. (27) av refm , av refp (analog reference voltage) input these are reference voltage supply pins for the a/d converter. (28) av dd (analog power supply) this is a 3.3 v positive power supply pin for the a/d converter. (29) av ss (analog ground) this is a ground pin for the a/d converter. (30) ev dd (port power supply) this is a 3.3 v positive power supply pin for port. (31) ev ss (port ground) this is a ground pin for port. (32) oscv dd (power supply for clock generator) this is a 3.3 v positive power supply pin for the clock generator. (33) oscv ss (ground for clock generator) this is a ground pin for the clock generator. (34) uv dd (ground) this is a 3.3 v positive power supply pin for the usb. (35) udp (usb data +) i/o this is a data i/o pin (+) of the usb. (36) udm (usb data ? ? ? ? ) i/o this is a data i/o pin ( ? ) of the usb. (37) iv dd (power supply) these are 1.5 v positive power supply pins for each internal unit. all the iv dd pins should be connected to a positive power supply. (38) iv ss (ground) these are ground pins. all the iv ss pins should be grounded. (39) a2 to a15 (address) output these are the address output pins of the lower 14 bits of the address bus?s 26-bit address when the external memory is accessed.
chapter 2 pin functions 63 preliminar y user ? s manual u16031ej2v1ud (40) d0 to d15 (data) 3-state i/o these pins constitute a data bus for when the external memory is accessed. these are the lower 16-bit i/o bus pins of the 32-bit data. the output changes in synchronization with the rise of the busclk signal in the t1 state. (41) trcclk (trace clock) output this is a trace clock output pin. (42) trcdata0 to trcdata3 (trace data output) output these are trace data output (d0 to d3) pins. (43) trcend (trace end status output) output this is a trace end status output pin.
chapter 2 pin functions 64 preliminar y user ? s manual u16031ej2v1ud 2.4 pin i/o circuits and recommended connection of unused pins it is recommended that 1 to 10 k ? resistors be used when connecting to v dd or v ss via resistors. (1/3) pin name i/o circuit type recommended connection p10/intp10/uclk 5 p11/intp11/sck0 p12/si0/rxd0 8-j p13/so0/txd0 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open. p20/nmi 2 connect to v ss directly. p21/intp21/rxd1 8-j p22/intp22/txd1 5 p23/intp23/sck1 p24/intp24/si1 8-j p25/intp25/so1 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open. p50/intp50/dmarq0 5 input: independently connect to ev dd via a resistor. output: leave open. p51/intp51/dmaak0 p52/intp52/tc0 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open. p53/intpc00/tic0/dmarq1 5 input: independently connect to ev dd via a resistor. output: leave open. p54/intpc01/dmaak1 p55/toc0/tc1 p65/intp65/intpc10/tic1 p66/intp66/intpc11 p67/intp67/toc1 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open. p72/intpc20/tic2/dmarq2 5 input: independently connect to ev dd via a resistor. output: leave open. p73/intpc21/dmaak2 p74/toc2/tc2 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open. p75/intpc30/tic3/dmarq3 5 input: independently connect to ev dd via a resistor. output: leave open. p76/intpc31/dmaak3 p77/toc3/tc3 pal0/intpl0/a0, pal1/intpl1/a1 pah0/a16 to pah9/a25 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open.
chapter 2 pin functions 65 preliminar y user ? s manual u16031ej2v1ud (2/3) pin name i/o circuit type recommended connection pdh0/d16/intpd0 pdh1/d17/intpd1 pdh2/d18/intpd2/toc4 pdh3/d19/intpd3 pdh4/d20/intpd4 pdh5/d21/intpd5/toc5 pdh6/d22/intpd6/intp100/tcud10 pdh7/d23/intpd7/intp101/tclr10 pdh8/d24/intpd8/to10 pdh9/d25/intpd9/tiud10 pdh10/d26/intpd10/intp110/tcud11 pdh11/d27/intpd11/intp111/tclr11 pdh12/d28/intpd12/to11 pdh13/d29/intpd13/tiud11 pdh14/d30/intpd14/pwm0 pdh15/d31/intpd15/pwm1 pcs0/cs0 pcs1/cs1 pcs2/cs2/iowr pcs3/cs3 pcs4/cs4 pcs5/cs5/iord pcs6/cs6 pcs7/cs7 pct0/llwr/llbe/lldqm pct1/luwr/lube/ludqm pct2/ulwr/ulbe/uldqm pct3/uuwr/uube/uudqm pct4/rd pct5/we/wr pct7/bcyst 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open. pcm0/wait 5 input: independently connect to ev dd via a resistor. output: leave open. pcm1 8-j pcm2/hldak 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open.
chapter 2 pin functions 66 preliminar y user ? s manual u16031ej2v1ud (3/3) pin name i/o circuit type recommended connection pcm3/hldrq 5 input: independently connect to ev dd via a resistor. output: leave open. pcm4/refrq 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open. pcm5/adtrg/selfref 5 input: independently connect to ev dd via a resistor. output: leave open. pcd0/sdcke pcd1/busclk pcd2/sdcas pcd3/sdras a2 to a15 d0 to d15 5 input: independently connect to ev dd or ev ss via a resistor. output: leave open. av dd ? connect to ev dd . av ss ? connect to ev ss . dck ddi dms 1 connect to ev dd via a resistor. ddo 1 leave open. drst 1 connect to ev ss . trcclk 1 trcdata0 to trcdata3 1 trcend 1 leave open. uv dd ? connect to ev dd . udm udp 24-a ani0 to ani7 9-e av refm ? connect to ev ss . av refp ? connect to ev dd .
chapter 2 pin functions 67 preliminar y user ? s manual u16031ej2v1ud 2.5 pin i/o circuits type 1 type 2 type 5 p-ch n-ch in v dd in schmitt-triggered input with hysteresis characteristics p-ch n-ch v dd in/out data output disable input enable type 8-j p-ch n-ch v dd in/out data output disable type 9-e type 24-a in av ref av ss + ? output data output data input data uv dd p-ch n-ch in/out ev ss
68 preliminar y user?s manual u16031ej2v1ud chapter 3 cpu function the cpu of the v850e/me2 is based on risc architecture and executes almost all the instructions in one clock cycle using 5-stage pipeline control. 3.1 features  minimum instruction execution time: 10 ns/7.5 ns/6.7 ns (@100 mhz/133 mhz/150 mhz internal operation)  memory space program space: 64 mb linear data space: 4 gb linear  thirty-two 32-bit general-purpose registers  internal 32-bit architecture  five-stage pipeline control  multiply/divide instructions  saturated operation instructions  one-clock 32-bit shift instruction  load/store instruction with long/short format  four types of bit manipulation instructions  set1 clr1 not1 tst1
chapter 3 cpu function 69 preliminar y user?s manual u16031ej2v1ud 3.2 cpu register set the registers of the v850e/me2 can be classified into two categories: a general-purpose program register set and a dedicated system register set. all the registers have a 32-bit width. for details, refer to v850e1 architecture user?s manual . figure 3-1. cpu register set (1) program register set (2) system register set r0 (zero register) r1 (assembler-reserved register) r2 r3 (stack pointer (sp)) r4 (global pointer (gp)) r5 (text pointer (tp)) r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 (element pointer (ep)) r31 (link pointer (lp)) 31 0 pc (program counter) 31 0 eipc (status saving register during interrupt) eipsw (status saving register during interrupt) fepc (status saving register during nmi) fepsw (status saving register during nmi) ecr (interrupt source register) psw (program status word) ctpc (status saving register during callt execution) ctpsw (status saving register during callt execution) dbpc (status saving register during exception/debug trap) dbpsw (status saving register during exception/debug trap) ctbp (callt base pointer) dir (debug interface register) bpc0 (breakpoint control register 0) bpc1 (breakpoint control register 1) asid (program id register) bpav0 (breakpoint address setting register 0) bpav1 (breakpoint address setting register 1) bpam0 (breakpoint address mask register 0) bpam1 (breakpoint address mask register 1) bpdv0 (breakpoint data setting register 0) bpdv1 (breakpoint data setting register 1) bpdm0 (breakpoint data mask register 0) bpdm1 (breakpoint data mask register 1) 31 0
chapter 3 cpu function 70 preliminar y user ? s manual u16031ej2v1ud 3.2.1 program register set the program register set includes general-purpose registers and a program counter. (1) general-purpose registers thirty-two general-purpose registers, r0 to r31, are available. any of these registers can be used as a data variable or address variable. however, r0 and r30 are implicitly used by instructions, and care must be exercised when using these registers. r0 is a register that always holds 0, and is used for operations using 0 and offset 0 addressing. r30 is used, by means of the sld and sst instructions, as a base pointer for when memory is accessed. also, r1, r3 to r5, and r31 are implicitly used by the assembler and c compiler. therefore, before using these registers, their contents must be saved so that they are not lost. the contents must be restored to the registers after the registers have been used. r2 may be used by the real-time os. if the real-time os does not use r2, it can be used as a variable register. table 3-1. program registers name usage operation r0 zero register always holds 0 r1 assembler-reserved register working register for generating 32-bit immediate data r2 address/data variable register (when r2 is not used by the real-time os) r3 stack pointer used to generate stack frame when function is called r4 global pointer used to access global variable in data area r5 text pointer register to indicate the start of the text area (where program code is located) r6 to r29 address/data variable registers r30 element pointer base pointer when memory is accessed r31 link pointer used by compiler when calling function pc program counter holds instruction address during program execution (2) program counter (pc) this register holds the instruction address during program execution. the lower 26 bits of this register are valid, and bits 31 to 26 are fixed to 0. if a carry occurs from bit 25 to 26, it is ignored. bit 0 is fixed to 0, and branching to an odd address cannot be performed. 31 26 25 1 0 pc fixed to 0 instruction address during execution 0 after reset 00100000h
chapter 3 cpu function 71 preliminar y user ? s manual u16031ej2v1ud 3.2.2 system register set system registers control the status of the cpu and hold interrupt information. to read/write these system registers, specify a system register number indicated below using the system register load/store instruction (ldsr or stsr instruction). table 3-2. system register numbers operand specification no. system register name ldsr instruction stsr instruction 0 status saving register during interrupt (eipc) note 1 {{ 1 status saving register during interrupt (eipsw) note 1 {{ 2 status saving register during nmi (fepc) {{ 3 status saving register during nmi (fepsw) {{ 4 interrupt source register (ecr) { 5 program status word (psw) {{ 6 to 15 reserved for future function expansion (operations that access these register numbers cannot be guaranteed). 16 status saving register during callt execution (ctpc) {{ 17 status saving register during callt execution (ctpsw) {{ 18 status saving register during exception/debug trap (dbpc) { note 2 { 19 status saving register during exception/debug trap (dbpsw) { note 2 { 20 callt base pointer (ctbp) {{ 21 debug interface register (dir) { note 3 { 22 breakpoint control register 0, 1 (bpc0, bpc1) { note 3 { note 3 23 program id register (asid) {{ 24 breakpoint address setting register 0, 1 (bpav0, bpav1) { note 3 { note 3 25 breakpoint address mask register 0, 1 (bpam0, bpam1) { note 3 { note 3 26 breakpoint data setting register 0, 1 (bpdv0, bpdv1) { note 3 { note 3 27 breakpoint data mask register 0, 1 (bpdm0, bpdm1) { note 3 { note 3 28 to 31 reserved for future function expansion (operations that access these register numbers cannot be guaranteed). notes 1. because these registers have only one set, to enable multiple interrupts, it is necessary to save these registers by program. 2. these registers can be accessed only in the debug mode. if they are accessed in the user mode, the result is undefined. 3. accessing these registers in a mode other than the debug mode is prohibited. caution even if bit 0 of eipc, fepc, or ctpc is set to 1 by the ldsr instruction, bit 0 will be ignored when the program is returned by the reti instruction after interrupt servicing (because bit 0 of the pc is fixed to 0). when setting the value of eipc, fepc, and ctpc, use an even value (bit 0 = 0) unless there is a special reason not to. remark { : access allowed : access prohibited
chapter 3 cpu function 72 preliminar y user ? s manual u16031ej2v1ud (1) interrupt source register (ecr) 31 0 ecr fecc eicc after reset 00000000h 16 15 bit position bit name function 31 to 16 fecc exception code of non-maskable interrupt (nmi) 15 to 0 eicc exception code of exception/maskable interrupt (2) program status word (psw) (1/2) 31 0 1 2 3 4 5 6 7 8 9 10 11 12 psw rfu rfu ss np ep id sat cy ov sz after reset 00000020h bit position flag function 31 to 12, 10 to 8 rfu reserved field (fixed to 0). 11 ss when this flag is set to 1, single-step execution takes place (a debug trap is generated each time an instruction has been executed). this flag is cleared to 0 when execution branches to an interrupt servicing routine. when the se bit of the dir register is 0, this flag is not set to 1 (fixed to 0). 7 np indicates that non-maskable interrupt (nmi) servicing is in progress. this flag is set when an nmi is acknowledged, and disables multiple interrupts. 0: nmi servicing not under execution. 1: nmi servicing under execution. 6 ep indicates that exception processing is in progress. this flag is set when an exception is generated. moreover, interrupt requests can be acknowledged when this bit is set. 0: exception processing not under execution. 1: exception processing under execution. 5 id indicates whether a maskable interrupt request can be acknowledged or not. 0: interrupt enabled (ei). 1: interrupt disabled (di).
chapter 3 cpu function 73 preliminar y user ? s manual u16031ej2v1ud (2/2) bit position flag function 4 sat note indicates that the operation result of a saturated operation processing instruction is saturated due to overflow. due to the cumulative flag, if the operation result is saturated by the saturation operation instruction, this bit is set (1), but is not cleared (0) even if the operation results of subsequent instructions are not saturated. to clear (0) this bit, load data in psw. note that in a general arithmetic operation, this bit is neither set (1) nor cleared (0). 0: not saturated. 1: saturated. 3cy this flag is set if a carry or borrow occurs as the result of an operation (if a carry or borrow does not occur, it is reset). 0: carry or borrow does not occur. 1: carry or borrow occurs. 2ov note this flag is set if an overflow occurs during operation (if an overflow does not occur, it is reset). 0: overflow does not occur. 1: overflow occurs. 1s note this flag is set if the result of an operation is negative (it is reset if the result is positive). 0: the operation result was positive or 0. 1: the operation result was negative. 0 z this flag is set if the result of an operation is zero (if the result is not zero, it is reset). 0: the operation result was not 0. 1: the operation result was 0. note the result of a saturation-processed operation is determined by the contents of the ov and s flags in the saturation operation. simply setting the ov flag (1) will set the sat flag (1) in a saturation operation. flag status status of operation result sat ov s saturation-processed operation result maximum positive value exceeded 1 1 0 7fffffffh maximum negative value exceeded 1 1 1 80000000h positive (not exceeding the maximum) 0 negative (not exceeding the maximum) retains the value before operation 0 1 operation result itself
chapter 3 cpu function 74 preliminar y user ? s manual u16031ej2v1ud 3.3 operating modes 3.3.1 operating modes the v850e/me2 has the following operating modes. mode specification is carried out using the mode0 and mode1 pins. (1) normal operation mode 32-bit mode, 16-bit mode after system reset is cleared, each pin related to the bus interface enters the control mode, the sram cycle branches to 0100000h (reset entry address) of the external device (memory), and instruction processing starts. in the 32-bit mode, the bus interface functions as a 32-bit data bus; it functions as a 16-bit data bus in the 16-bit mode. caution be sure to allocate external memory to address 0100000h for correct operation. 3.3.2 operating mode specification the operating mode is specified according to the status of the mode0 and mode1 pins. in an application system fix the specification of these pins and do not change them during operation. operation is not guaranteed if these pins are changed during operation. mode1 mode0 operating mode remarks l l 32-bit mode 32-bit data bus lh normal operation mode 16-bit mode 16-bit data bus other than above setting prohibited remark l: low-level input h: high-level input x: don ? t care
chapter 3 cpu function 75 preliminar y user ? s manual u16031ej2v1ud 3.4 address space 3.4.1 cpu address space the cpu of the v850e/me2 is of 32-bit architecture and supports up to 4 gb of linear address space (data space) during operand addressing (data access). also, in instruction address addressing, a maximum of 64 mb of linear address space (program space) is supported. figure 3-2 shows the cpu address space. figure 3-2. cpu address space ffffffffh 04000000h 03ffffffh 00000000h data area (4 gb linear) program area (64 mb linear) cpu address space
chapter 3 cpu function 76 preliminar y user ? s manual u16031ej2v1ud 3.4.2 image a 256 mb physical address space is seen as 16 images in the 4 gb cpu address space. in actuality, the same 256 mb physical address space is accessed regardless of the values of bits 31 to 28 of the cpu address. figure 3-3 shows the image of the virtual addressing space. physical address x0000000h can be seen as cpu address 00000000h, and in addition, can be seen as address 10000000h, address 20000000h, ? , address e0000000h, or address f0000000h. figure 3-3. images on address space ffffffffh f0000000h efffffffh 00000000h internal instruction ram image image image internal data ram peripheral i/o external memory physical address space fffffffh 0000000h image image e0000000h dfffffffh 20000000h 1fffffffh 10000000h 0fffffffh cpu address space
chapter 3 cpu function 77 preliminar y user ? s manual u16031ej2v1ud 3.4.3 wrap-around of cpu address space (1) program space of the 32 bits of the pc (program counter), the higher 6 bits are fixed to 0, and only the lower 26 bits are valid. even if a carry or borrow occurs from bit 25 to 26 as a result of a branch address calculation, the higher 6 bits ignore the carry or borrow. therefore, the lower-limit address of the program space, address 00000000h, and the upper-limit address 03ffffffh become contiguous addresses. wrap-around refers to a situation like this whereby the lower- limit address and upper-limit address become contiguous. caution the 32 kb area of 03fff800h to 03ffffffh can be seen as an image of 0ffff800h to 0fffffffh. instructions cannot be fetched from this area because it is an on-chip peripheral i/o area, internal data ram area, or access-prohibited area. therefore, do not execute any branch address calculation in which the result will reside in any part of this area. 03fffffeh 03ffffffh 00000000h 00000001h program space program space (+) direction ( ) direction (2) data space the result of an operand address calculation that exceeds 32 bits is ignored. therefore, the lower-limit address of the program space, address 00000000h, and the upper-limit address ffffffffh are contiguous addresses, and the data space is wrapped around at the boundary of these addresses. fffffffeh ffffffffh 00000000h 00000001h data space data space (+) direction ( ) direction
chapter 3 cpu function 78 preliminar y user ? s manual u16031ej2v1ud 3.4.4 memory map areas are reserved in the v850e/me2 as shown in figure 3-4. figure 3-4. memory map 32-bit mode, 16-bit mode on-chip peripheral i/o/ internal data ram area internal data ram area (16 kb) on-chip peripheral i/o area (4 kb) access-prohibited area note 2 external memory area external memory area on-chip peripheral i/o mirror note 1 internal data ram mirror access-prohibited area note 2 internal instruction ram area (128 kb) xfffffffh xfff8000h xfff7fffh xfffffffh xfff8000h xffff000h xfffefffh xfffb000h xfffafffh x4000000h x3ffffffh x3fff000h x3ffefffh x3ffb000h x3ffafffh x3ff8000h x3ff7fffh x0100000h x00fffffh x0020000h x001ffffh x0000000h internal instruction ram area (1 mb) program area (64 mb) notes 1. accessing addresses 3fff000h to 3ffffffh is prohibited. specify addresses ffff000h to fffffffh to access the on-chip peripheral i/o. 2. the operation is not guaranteed if an access-prohibited area is accessed. caution external memory access cannot be made to the internal data ram, internal instruction ram, and on-chip peripheral i/o areas.
chapter 3 cpu function 79 preliminar y user?s manual u16031ej2v1ud 3.4.5 area (1) internal instruction ram area (a) memory map 1 mb of internal instruction ram area, addresses 00000h to fffffh, is reserved. 128 kb are provided at addresses 000000h to 01ffffh as physical instruction ram. caution external memory access cannot be made to addresses 020000h to ffffffh. if this area is accessed, the address bus (a0 to a25) outputs a low level, the data bus (d0 to d31) goes into a high-impedance state without outputting anything, and the external bus control signal becomes inactive. (b) interrupt/exception table the v850e/me2 increases the interrupt response speed by assigning handler addresses corresponding to interrupts/exceptions. the collection of these handler addresses is called an interrupt/exception table, which is located in the internal instruction ram area. when an interrupt/exception request is acknowledged, execution jumps to the handler address, and the program written in that memory is executed. table 3-3 shows the sources of interrupts/exceptions, and the corresponding addresses. table 3-3. interrupt/exception table (1/2) start address of interrupt/exception table interrupt/exception source start address of interrupt/exception table interrupt/exception source 00100000h reset 00000170h intpd2 00000010h nmi0 00000180h intpd3 00000040h trap0n (n = 0 to f) 00000190h intpd4 00000050h trap1n (n = 0 to f) 000001a0h intpd5 00000060h ilgop/dbg0 000001b0h intpd6 00000080h intp10 000001c0h intpd7 00000090h intp11 000001d0h intpd8 000000a0h intp21 000001e0h intpd9 000000b0h intp22 000001f0h intpd10 000000c0h intp23 00000200h intpd11 000000d0h intp24 00000210h intpd12 000000e0h intp25 00000220h intpd13 000000f0h intp50 00000230h intpd14 00000100h intp51 00000240h intpd15 00000110h intp52 00000250h intpl0 00000120h intp65 00000260h intpl1 00000130h intp66 00000270h intovc0 00000140h intp67 00000280h intovc1 00000150h intpd0 00000290h intovc2 00000160h intpd1 000002a0h intovc3
chapter 3 cpu function 80 preliminar y user?s manual u16031ej2v1ud table 3-3. interrupt/exception table (2/2) start address of interrupt/exception table interrupt/exception source start address of interrupt/exception table interrupt/exception source 000002b0h intovc4 00000470h intov11 000002c0h intovc5 00000480h intud11 000002d0h intpc00/intccc00 00000490h intdma0 000002e0h intpc01/intccc01 000004a0h intdma1 000002f0h intpc10/intccc10 000004b0h intdma2 00000300h intpc11/intccc11 000004c0h intdma3 00000310h intpc20/intccc20 000004d0h intcsi30 00000320h intpc21/intccc21 000004e0h intcovf30 00000330h intpc30/intccc30 000004f0h intcsi31 00000340h intpc31/intccc31 00000500h intcovf31 00000350h intccc40 00000510h ubtire0 00000360h intccc41 00000520h ubtir0 00000370h intccc50 00000530h ubtit0 00000380h intccc51 00000540h ubtif0 00000390h intcmd0 00000550h ubtito0 000003a0h intcmd1 00000560h ubtire1 000003b0h intcmd2 00000570h ubtir1 000003c0h intcmd3 00000580h ubtit1 000003d0h intcc100 00000590h ubtif1 000003e0h intcc101 000005a0h ubtito1 000003f0h intcm100 000005b0h intad 00000400h intcm101 000005c0h intusb0b 00000410h intov10 000005d0h intusb1b 00000420h intud10 000005e0h intusb2b 00000430h intcc110 000005f0h u sbsp2b 00000440h intcc111 00000600h u sbsp4b 00000450h intcm110 00000610h intrsum 00000460h intcm111
chapter 3 cpu function 81 preliminar y user ? s manual u16031ej2v1ud (2) internal data ram area the 16 kb area of addresses fffb000h to fffefffh is provided as the internal data ram area. the 16 kb area of 3ffb000h to 3ffefffh can be seen as an image of fffb000h to fffefffh. cautions 1. external memory access cannot be made to addresses xfff8000h to xfffafffh and x3ff8000h to x3ffafffh. the operation is not guaranteed if external memory access is performed. 2. do not execute the program in the internal data ram area. fffefffh fffb000h fffafffh fff8000h internal data ram area (16 kb) access-prohibited area
chapter 3 cpu function 82 preliminar y user ? s manual u16031ej2v1ud (3) on-chip peripheral i/o area 4 kb of memory, addresses ffff000h to fffffffh, are provided as an on-chip peripheral i/o area. an image of addresses ffff000h to fffffffh can be seen at addresses 3fff000h to 3ffffffh note . note addresses 3fff000h to 3ffffffh are access-prohibited. to access the on-chip peripheral i/o, specify addresses ffff000h to fffffffh. fffffffh ffff000h on-chip peripheral i/o area (4 kb) peripheral i/o registers associated with the operating mode specification and the state monitoring for the on- chip peripheral i/o are all memory-mapped to the on-chip peripheral i/o area. program fetches cannot be executed from this area. cautions 1. for registers in which byte access is possible, if halfword access is executed, the higher 8 bits become undefined during a read operation, and the lower 8 bits of data are written to the register during a write operation. do not access an 8-bit register in halfword units. 2. addresses that are not defined as registers are reserved for future expansion. if these addresses are accessed, the operation is undefined and not guaranteed. addresses 3fff000h to 3ffffffh cannot be specified as the source/destination address of dma transfer. be sure to use addresses ffff000h to fffffffh for the source/destination address of dma transfer. (4) external memory area 256 mb are available for external memory area. the lower 64 mb can be used as program/data area and the higher 192 mb as data area. the external memory area is addresses x0100000h to xfdfffffh. access to the external memory area is performed using the chip select signal assigned to each memory block (which is carried out in the cs unit set by chip area select control registers 0 and 1 (csc0, csc1)). note that the internal instruction ram, internal data ram, and on-chip peripheral i/o areas cannot be used as external memory areas.
chapter 3 cpu function 83 preliminar y user ? s manual u16031ej2v1ud 3.4.6 recommended use of address space the architecture of the v850e/me2 requires that a register that serves as a pointer be secured for address generation in operand data accessing of data space. operand data access from instruction can be directly executed at the address in this pointer register 32 kb. however, because the general-purpose registers that can be used as a pointer register are limited, by minimizing the deterioration of address calculation performance when changing the pointer value, the number of usable general-purpose registers for handling variables is maximized, and the program size can be saved. in connection with the memory map of the v850e/me2, the following usage is recommended to enhance the efficiency of pointer operation. (1) program space of the 32 bits of the program counter (pc), the higher 6 bits are fixed to 0, and only the lower 26 bits are valid. therefore, a contiguous 64 mb space, starting from address 00000000h, unconditionally corresponds to the memory map of the program space. (2) data space to efficiently operate the resources using wrap-around of the data space, a consecutive 16 mb are used as a data space at each of the 4 gb cpu address spaces of 00000000h to 00ffffffh and ff000000h to ffffffffh. with the v850e/me2, a 256 mb physical address space is seen as 16 images in the 4 gb cpu address space. the highest bit (bit 25) of this 26-bit address is assigned as an address sign-extended to 32 bits. example application of wrap-around is as shown below. 32 kb 4 kb 16 kb 12 kb 0001ffffh 00007fffh (r=) 00000000h fffff000h ffffefffh ffffb000h ffffafffh ffff8000h internal instruction ram area on-chip peripheral i/o area internal data ram area access-prohibited area when r = r0 (zero register) is specified with the ld/st disp16[r] instruction, an addressing range of 00000000h 32 kb can be referenced with the sign-extended disp16. the zero register (r0) is a register fixed to 0 by the hardware, and eliminates the need for additional registers for the pointer.
chapter 3 cpu function 84 preliminar y user ? s manual u16031ej2v1ud figure 3-5. recommended memory map data space program space on-chip peripheral i/o on-chip peripheral i/o internal data ram access prohibited note 2 access prohibited note 2 internal data ram access prohibited note 2 internal data ram external memory internal instruction ram external memory external memory on-chip peripheral i/o note 1 program space 64 mb internal instruction ram internal instruction ram ffffffffh fffff000h ffffefffh ffffb000h ffffafffh ffff8000h ffff7fffh xfffffffh xffff000h xfffefffh xfff8000h xfff7fffh x0100000h x00fffffh x0020000h x0000000h x001ffffh xfffb000h xfffafffh 04000000h 03ffffffh 03fff000h 03ffefffh 03ffb000h 03ffafffh 03ff8000h 03ff7fffh 00100000h 000fffffh 00020000h 00000000h 0001ffffh notes 1. this area is access-prohibited. to access the on-chip peripheral i/o, specify addresses ffff000h to fffffffh. 2. the operation is not guaranteed if an access-prohibited area is accessed. remark the arrows indicate the recommended area.
chapter 3 cpu function 85 preliminar y user ? s manual u16031ej2v1ud 3.4.7 peripheral i/o registers (1/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff000h port al pal r/w undefined fffff000h port all pall r/w ? undefined fffff001h port alh palh r ? 00h fffff002h port ah pah r/w undefined fffff002h port ahl pahl r/w ? undefined fffff003h port ahh pahh r/w ? undefined fffff006h port dh pdh r/w undefined fffff006h port dhl pdhl r/w ? undefined fffff007h port dhh pdhh r/w ? undefined fffff008h port cs pcs r/w ? undefined fffff00ah port ct pct r/w ? undefined fffff00ch port cm pcm r/w ? undefined fffff00eh port cd pcd r/w ? undefined fffff020h port al mode register pmal r/w ffffh fffff020h port al mode register l pmall r/w ? ffh fffff021h port al mode register h pmalh r ? ffh fffff022h port ah mode register pmah r/w ffffh fffff022h port ah mode register l pmahl r/w ? ffh fffff023h port ah mode register h pmahh r/w ? ffh fffff026h port dh mode register pmdh r/w ffffh fffff026h port dh mode register l pmdhl r/w ? ffh fffff027h port dh mode register h pmdhh r/w ? ffh fffff028h port cs mode register pmcs r/w ? ffh fffff02ah port ct mode register pmct r/w ? ffh fffff02ch port cm mode register pmcm r/w ? ffh fffff02eh port cd mode register pmcd r/w ? ffh fffff040h port al mode control register pmcal r/w 0002h fffff040h port al mode control register l pmcall r/w ? 02h fffff041h port al mode control register h pmcalh r ? 00h fffff042h port ah mode control register pmcah r/w 03ffh fffff042h port ah mode control register l pmcahl r/w ? ffh fffff043h port ah mode control register h pmcahh r/w ? 03h fffff046h port dh mode control register pmcdh r/w 0000h fffff046h port dh mode control register l pmcdhl r/w ? 00h fffff047h port dh mode control register h pmcdhh r/w ? 00h fffff048h port cs mode control register pmccs r/w ? ffh fffff049h port cs function control register pfccs r/w ? 00h
chapter 3 cpu function 86 preliminar y user ? s manual u16031ej2v1ud (2/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff04ah port ct mode control register pmcct r/w ? bfh fffff04bh port ct function control register pfcct r/w ? 00h fffff04ch port cm mode control register pmccm r/w ? 3dh fffff04dh port cm function control register pfccm r/w ? 00h fffff04eh port cd mode control register pmccd r/w ? 0fh fffff056h port dh function control register pfcdh r/w 0000h fffff056h port dh function control register l pfcdhl r/w ? 00h fffff057h port dh function control register h pfcdhh r/w ? 00h fffff058h port al function control register l pfcall r/w ? 03h fffff060h chip area select control register 0 csc0 r/w 2c11h fffff062h chip area select control register 1 csc1 r/w 2c11h fffff068h endian configuration register bec r/w 0000h fffff06ah cache configuration register bhc r/w 0000h fffff06eh system wait control register vswc r/w ? 77h fffff070h instruction cache control register icc r/w 0003h note 1 fffff070h instruction cache control register l iccl r/w ? 03h note 2 fffff071h instruction cache control register h icch r/w ? 00h fffff074h instruction cache data configuration register icd r/w undefined fffff080h dma source address register 0l dsa0l r/w undefined fffff082h dma source address register 0h dsa0h r/w undefined fffff084h dma destination address register 0l dda0l r/w undefined fffff086h dma destination address register 0h dda0h r/w undefined fffff088h dma source address register 1l dsa1l r/w undefined fffff08ah dma source address register 1h dsa1h r/w undefined fffff08ch dma destination address register 1l dda1l r/w undefined fffff08eh dma destination address register 1h dda1h r/w undefined fffff090h dma source address register 2l dsa2l r/w undefined fffff092h dma source address register 2h dsa2h r/w undefined fffff094h dma destination address register 2l dda2l r/w undefined fffff096h dma destination address register 2h dda2h r/w undefined fffff098h dma source address register 3l dsa3l r/w undefined fffff09ah dma source address register 3h dsa3h r/w undefined fffff09ch dma destination address register 3l dda3l r/w undefined notes 1. this register is set to 0003h and the tag is automatically initialized when the reset signal becomes active. when initialization of the tag is completed, the register is cleared to 0000h. 2. this register is set to 03h and the tag is automatically initialized when the reset signal becomes active. when initialization of the tag is completed, the register is cleared to 00h.
chapter 3 cpu function 87 preliminar y user ? s manual u16031ej2v1ud (3/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff09eh dma destination address register 3h dda3h r/w undefined fffff0c0h dma transfer count register 0 dbc0 r/w undefined fffff0c2h dma transfer count register 1 dbc1 r/w undefined fffff0c4h dma transfer count register 2 dbc2 r/w undefined fffff0c6h dma transfer count register 3 dbc3 r/w undefined fffff0d0h dma addressing control register 0 dadc0 r/w 0000h fffff0d2h dma addressing control register 1 dadc1 r/w 0000h fffff0d4h dma addressing control register 2 dadc2 r/w 0000h fffff0d6h dma addressing control register 3 dadc3 r/w 0000h fffff0e0h dma channel control register 0 dchc0 r/w ? 00h fffff0e2h dma channel control register 1 dchc1 r/w ? 00h fffff0e4h dma channel control register 2 dchc2 r/w ? 00h fffff0e6h dma channel control register 3 dchc3 r/w ? 00h fffff100h interrupt mask register 0 imr0 r/w ffffh fffff100h interrupt mask register 0l imr0l r/w ? ffh fffff101h interrupt mask register 0h imr0h r/w ? ffh fffff102h interrupt mask register 1 imr1 r/w ffffh fffff102h interrupt mask register 1l imr1l r/w ? ffh fffff103h interrupt mask register 1h imr1h r/w ? ffh fffff104h interrupt mask register 2 imr2 r/w ffffh fffff104h interrupt mask register 2l imr2l r/w ? ffh fffff105h interrupt mask register 2h imr2h r/w ? ffh fffff106h interrupt mask register 3 imr3 r/w ffffh fffff106h interrupt mask register 3l imr3l r/w ? ffh fffff107h interrupt mask register 3h imr3h r/w ? ffh fffff108h interrupt mask register 4 imr4 r/w ffffh fffff108h interrupt mask register 4l imr4l r/w ? ffh fffff109h interrupt mask register 4h imr4h r/w ? ffh fffff10ah interrupt mask register 5 imr5 r/w ffffh fffff10ah interrupt mask register 5l imr5l r/w ? ffh fffff10bh interrupt mask register 5h imr5h r/w ? ffh fffff110h interrupt control register 0 p1ic0 r/w ? 47h fffff112h interrupt control register 1 p1ic1 r/w ? 47h fffff114h interrupt control register 2 p2ic1 r/w ? 47h fffff116h interrupt control register 3 p2ic2 r/w ? 47h fffff118h interrupt control register 4 p2ic3 r/w ? 47h fffff11ah interrupt control register 5 p2ic4 r/w ? 47h fffff11ch interrupt control register 6 p2ic5 r/w ? 47h
chapter 3 cpu function 88 preliminar y user ? s manual u16031ej2v1ud (4/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff11eh interrupt control register 7 p5ic0 r/w ? 47h fffff120h interrupt control register 8 p5ic1 r/w ? 47h fffff122h interrupt control register 9 p5ic2 r/w ? 47h fffff124h interrupt control register 10 p6ic5 r/w ? 47h fffff126h interrupt control register 11 p6ic6 r/w ? 47h fffff128h interrupt control register 12 p6ic7 r/w ? 47h fffff12ah interrupt control register 13 pdic0 r/w ? 47h fffff12ch interrupt control register 14 pdic1 r/w ? 47h fffff12eh interrupt control register 15 pdic2 r/w ? 47h fffff130h interrupt control register 16 pdic3 r/w ? 47h fffff132h interrupt control register 17 pdic4 r/w ? 47h fffff134h interrupt control register 18 pdic5 r/w ? 47h fffff136h interrupt control register 19 pdic6 r/w ? 47h fffff138h interrupt control register 20 pdic7 r/w ? 47h fffff13ah interrupt control register 21 pdic8 r/w ? 47h fffff13ch interrupt control register 22 pdic9 r/w ? 47h fffff13eh interrupt control register 23 pdic10 r/w ? 47h fffff140h interrupt control register 24 pdic11 r/w ? 47h fffff142h interrupt control register 25 pdic12 r/w ? 47h fffff144h interrupt control register 26 pdic13 r/w ? 47h fffff146h interrupt control register 27 pdic14 r/w ? 47h fffff148h interrupt control register 28 pdic15 r/w ? 47h fffff14ah interrupt control register 29 plic0 r/w ? 47h fffff14ch interrupt control register 30 plic1 r/w ? 47h fffff14eh interrupt control register 31 ovcic0 r/w ? 47h fffff150h interrupt control register 32 ovcic1 r/w ? 47h fffff152h interrupt control register 33 ovcic2 r/w ? 47h fffff154h interrupt control register 34 ovcic3 r/w ? 47h fffff156h interrupt control register 35 ovcic4 r/w ? 47h fffff158h interrupt control register 36 ovcic5 r/w ? 47h fffff15ah interrupt control register 37 ccc0ic0 r/w ? 47h fffff15ch interrupt control register 38 ccc0ic1 r/w ? 47h fffff15eh interrupt control register 39 ccc1ic0 r/w ? 47h fffff160h interrupt control register 40 ccc1ic1 r/w ? 47h fffff162h interrupt control register 41 ccc2ic0 r/w ? 47h fffff164h interrupt control register 42 ccc2ic1 r/w ? 47h fffff166h interrupt control register 43 ccc3ic0 r/w ? 47h fffff168h interrupt control register 44 ccc3ic1 r/w ? 47h
chapter 3 cpu function 89 preliminar y user ? s manual u16031ej2v1ud (5/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff16ah interrupt control register 45 ccc4ic0 r/w ? 47h fffff16ch interrupt control register 46 ccc4ic1 r/w ? 47h fffff16eh interrupt control register 47 ccc5ic0 r/w ? 47h fffff170h interrupt control register 48 ccc5ic1 r/w ? 47h fffff172h interrupt control register 49 cmdic0 r/w ? 47h fffff174h interrupt control register 50 cmdic1 r/w ? 47h fffff176h interrupt control register 51 cmdic2 r/w ? 47h fffff178h interrupt control register 52 cmdic3 r/w ? 47h fffff17ah interrupt control register 53 cc10ic0 r/w ? 47h fffff17ch interrupt control register 54 cc10ic1 r/w ? 47h fffff17eh interrupt control register 55 cm10ic0 r/w ? 47h fffff180h interrupt control register 56 cm10ic1 r/w ? 47h fffff182h interrupt control register 57 ov1ic0 r/w ? 47h fffff184h interrupt control register 58 ud1ic0 r/w ? 47h fffff186h interrupt control register 59 cc11ic0 r/w ? 47h fffff188h interrupt control register 60 cc11ic1 r/w ? 47h fffff18ah interrupt control register 61 cm11ic0 r/w ? 47h fffff18ch interrupt control register 62 cm11ic1 r/w ? 47h fffff18eh interrupt control register 63 ov1ic1 r/w ? 47h fffff190h interrupt control register 64 ud1ic1 r/w ? 47h fffff192h interrupt control register 65 dmaic0 r/w ? 47h fffff194h interrupt control register 66 dmaic1 r/w ? 47h fffff196h interrupt control register 67 dmaic2 r/w ? 47h fffff198h interrupt control register 68 dmaic3 r/w ? 47h fffff19ah interrupt control register 69 csi3ic0 r/w ? 47h fffff19ch interrupt control register 70 covf3ic0 r/w ? 47h fffff19eh interrupt control register 71 csi3ic1 r/w ? 47h fffff1a0h interrupt control register 72 covf3ic1 r/w ? 47h fffff1a2h interrupt control register 73 ureic0 r/w ? 47h fffff1a4h interrupt control register 74 uric0 r/w ? 47h fffff1a6h interrupt control register 75 utic0 r/w ? 47h fffff1a8h interrupt control register 76 uific0 r/w ? 47h fffff1aah interrupt control register 77 utoic0 r/w ? 47h fffff1ach interrupt control register 78 ureic1 r/w ? 47h fffff1aeh interrupt control register 79 uric1 r/w ? 47h fffff1b0h interrupt control register 80 utic1 r/w ? 47h fffff1b2h interrupt control register 81 uific1 r/w ? 47h fffff1b4h interrupt control register 82 utoic1 r/w ? 47h
chapter 3 cpu function 90 preliminar y user ? s manual u16031ej2v1ud (6/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff1b6h interrupt control register 83 adic r/w ? 47h fffff1b8h interrupt control register 84 us0bic r/w ? 47h fffff1bah interrupt control register 85 us1bic r/w ? 47h fffff1bch interrupt control register 86 us2bic r/w ? 47h fffff1beh interrupt control register 87 usp2ic r/w ? 47h fffff1c0h interrupt control register 88 usp4ic r/w ? 47h fffff1c2h interrupt control register 89 rsumic r/w ? 47h fffff1fah in-service priority register ispr r ? 00h fffff1fch command register prcmd w undefined fffff1feh power-save control register psc r/w ? 00h fffff200h a/d converter mode register 0 adm0 r/w ? 00h fffff201h a/d converter mode register 1 adm1 r/w ? 00h fffff202h a/d converter mode register 2 adm2 r/w ? 00h fffff210h a/d conversion result register 0 adcr0 r undefined fffff211h a/d conversion result register 0h adcr0h r undefined fffff212h a/d conversion result register 1 adcr1 r undefined fffff213h a/d conversion result register 1h adcr1h r undefined fffff214h a/d conversion result register 2 adcr2 r undefined fffff215h a/d conversion result register 2h adcr2h r undefined fffff216h a/d conversion result register 3 adcr3 r undefined fffff217h a/d conversion result register 3h adcr3h r undefined fffff218h a/d conversion result register 4 adcr4 r undefined fffff219h a/d conversion result register 4h adcr4h r undefined fffff21ah a/d conversion result register 5 adcr5 r undefined fffff21bh a/d conversion result register 5h adcr5h r undefined fffff21ch a/d conversion result register 6 adcr6 r undefined fffff21dh a/d conversion result register 6h adcr6h r undefined fffff21eh a/d conversion result register 7 adcr7 r undefined fffff21fh a/d conversion result register 7h adcr7h r undefined fffff220h adc trigger select register adts r/w 00h fffff402h port 1 p1 r/w ? undefined fffff404h port 2 p2 r/w ? undefined fffff40ah port 5 p5 r/w ? undefined fffff40ch port 6 p6 r/w ? undefined fffff40eh port 7 p7 r/w ? undefined fffff422h port 1 mode register pm1 r/w ? ffh fffff424h port 2 mode register pm2 r/w ? ffh fffff42ah port 5 mode register pm5 r/w ? ffh
chapter 3 cpu function 91 preliminar y user ? s manual u16031ej2v1ud (7/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff42ch port 6 mode register pm6 r/w ? ffh fffff42eh port 7 mode register pm7 r/w ? ffh fffff442h port 1 mode control register pmc1 r/w ? 00h fffff444h port 2 mode control register pmc2 r/w ? 01h fffff44ah port 5 mode control register pmc5 r/w ? 00h fffff44ch port 6 mode control register pmc6 r/w ? 00h fffff44eh port 7 mode control register pmc7 r/w ? 00h fffff462h port 1 function control register pfc1 r/w ? 00h fffff464h port 2 function control register pfc2 r/w ? 00h fffff46ah port 5 function control register pfc5 r/w ? 00h fffff46ch port 6 function control register pfc6 r/w ? 00h fffff46eh port 7 function control register pfc7 r/w ? 00h fffff480h bus cycle type configuration register 0 bct0 r/w 8888h fffff482h bus cycle type configuration register 1 bct1 r/w 8888h fffff484h data wait control register 0 dwc0 r/w 7777h fffff486h data wait control register 1 dwc1 r/w 7777h fffff488h bus cycle control register bcc r/w ffffh fffff48ah address setup wait control register asc r/w ffffh fffff48ch bus cycle period control register bcp r/w ? 00h fffff48eh local bus sizing control register lbs r/w 5555h/aaaah note fffff490h line buffer control register 0 lbc0 r/w 0000h fffff492h line buffer control register 1 lbc1 r/w 0000h fffff494h dma flyby transfer wait control register fwc r/w 7777h fffff496h dma flyby transfer idle control register fic r/w 3333h fffff498h bus mode control register bmc r/w 00h fffff49ah page rom configuration register prc r/w 7000h fffff4a4h sdram configuration register 1 scr1 r/w 30c0h fffff4a6h sdram refresh control register 1 rfs1 r/w 0000h fffff4ach sdram configuration register 3 scr3 r/w 30c0h fffff4aeh sdram refresh control register 3 rfs3 r/w 0000h fffff4b0h sdram configuration register 4 scr4 r/w 30c0h fffff4b2h sdram refresh control register 4 rfs4 r/w 0000h fffff4b8h sdram configuration register 6 scr6 r/w 30c0h fffff4bah sdram refresh control register 6 rfs6 r/w 0000h fffff540h timer d0 tmd0 r 0000h note 32-bit mode: aaaah 16-bit mode: 5555h for details of 32-bit mode and 16-bit mode, refer to 3.3.1 operating modes.
chapter 3 cpu function 92 preliminar y user ? s manual u16031ej2v1ud (8/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff542h compare register d0 cmd0 r/w 0000h fffff544h timer mode control register d0 tmcd0 r/w ? 00h fffff550h timer d1 tmd1 r 0000h fffff552h compare register d1 cmd1 r/w 0000h fffff554h timer mode control register d1 tmcd1 r/w ? 00h fffff560h timer d2 tmd2 r 0000h fffff562h compare register d2 cmd2 r/w 0000h fffff564h timer mode control register d2 tmcd2 r/w ? 00h fffff570h timer d3 tmd3 r 0000h fffff572h compare register d3 cmd3 r/w 0000h fffff574h timer mode control register d3 tmcd3 r/w ? 00h fffff5a0h timer enc10 tmenc10 r/w 0000h fffff5a2h compare register 100 cm100 r/w 0000h fffff5a4h compare register 101 cm101 r/w 0000h fffff5a6h capture/compare register 100 cc100 r/w 0000h fffff5a8h capture/compare register 101 cc101 r/w 0000h fffff5aah capture/compare control register 10 ccr10 r/w ? 00h fffff5abh timer unit mode register 10 tum10 r/w ? 00h fffff5ach timer control register 10 tmc10 r/w ? 00h fffff5adh valid edge select register 10 sesa10 r/w ? 00h fffff5aeh prescaler mode register 10 prm10 r/w ? 07h fffff5afh status register 10 status10 r ? 00h fffff5c0h noise elimination width setting register 10 ncw10 r/w 02h fffff5d0h timer enc11 tmenc11 r/w 0000h fffff5d2h compare register 110 cm110 r/w 0000h fffff5d4h compare register 111 cm111 r/w 0000h fffff5d6h capture/compare register 110 cc110 r/w 0000h fffff5d8h capture/compare register 111 cc111 r/w 0000h fffff5dah capture/compare control register 11 ccr11 r/w ? 00h fffff5dbh timer unit mode register 11 tum11 r/w ? 00h fffff5dch timer control register 11 tmc11 r/w ? 00h fffff5ddh valid edge select register 11 sesa11 r/w ? 00h fffff5deh prescaler mode register 11 prm11 r/w ? 07h fffff5dfh status register 11 status11 r ? 00h fffff5f0h noise elimination width setting register 11 ncw11 r/w 02h fffff600h timer c0 tmc0 r 0000h fffff602h capture/compare register c00 ccc00 r/w 0000h fffff604h capture/compare register c01 ccc01 r/w 0000h
chapter 3 cpu function 93 preliminar y user ? s manual u16031ej2v1ud (9/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff606h timer mode control register c00 tmcc00 r/w ? 00h fffff608h timer mode control register c01 tmcc01 r/w 20h fffff609h valid edge select register c0 sesc0 r/w 00h fffff610h noise elimination width setting register c0 ncwc0 r/w 02h fffff620h timer c1 tmc1 r 0000h fffff622h capture/compare register c10 ccc10 r/w 0000h fffff624h capture/compare register c11 ccc11 r/w 0000h fffff626h timer mode control register c10 tmcc10 r/w ? 00h fffff628h timer mode control register c11 tmcc11 r/w 20h fffff629h valid edge select register c1 sesc1 r/w 00h fffff630h noise elimination width setting register c1 ncwc1 r/w 02h fffff640h timer c2 tmc2 r 0000h fffff642h capture/compare register c20 ccc20 r/w 0000h fffff644h capture/compare register c21 ccc21 r/w 0000h fffff646h timer mode control register c20 tmcc20 r/w ? 00h fffff648h timer mode control register c21 tmcc21 r/w 20h fffff649h valid edge select register c2 sesc2 r/w 00h fffff650h noise elimination width setting register c2 ncwc2 r/w 02h fffff660h timer c3 tmc3 r 0000h fffff662h capture/compare register c30 ccc30 r/w 0000h fffff664h capture/compare register c31 ccc31 r/w 0000h fffff666h timer mode control register c30 tmcc30 r/w ? 00h fffff668h timer mode control register c31 tmcc31 r/w 20h fffff669h valid edge select register c3 sesc3 r/w 00h fffff670h noise elimination width setting register c3 ncwc3 r/w 02h fffff680h timer c4 tmc4 r 0000h fffff682h capture/compare register c40 ccc40 r/w 0000h fffff684h capture/compare register c41 ccc41 r/w 0000h fffff686h timer mode control register c40 tmcc40 r/w ? 00h fffff688h timer mode control register c41 tmcc41 r/w 20h fffff6a0h timer c5 tmc5 r 0000h fffff6a2h capture/compare register c50 ccc50 r/w 0000h fffff6a4h capture/compare register c51 ccc51 r/w 0000h fffff6a6h timer mode control register c50 tmcc50 r/w ? 00h fffff6a8h timer mode control register c51 tmcc51 r/w 20h fffff6c0h oscillation stabilization time select register osts r/w 04h fffff80ah internal instruction ram mode register iramm r/w ? 03h fffff80ch nmi reset status register nrs r ? 00h
chapter 3 cpu function 94 preliminar y user ? s manual u16031ej2v1ud (10/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffff810h dma trigger factor register 0 dtfr0 r/w ? 00h fffff812h dma trigger factor register 1 dtfr1 r/w ? 00h fffff814h dma trigger factor register 2 dtfr2 r/w ? 00h fffff816h dma trigger factor register 3 dtfr3 r/w ? 00h fffff820h power-save mode register psmr r/w ? 00h fffff822h clock control register ckc r/w 03h fffff824h lock register lockr r ? 01h fffff82ch clock source select register cks r/w ? 00h fffff82eh usb clock control register uckc r/w ? 00h fffff836h sscg control register sscgc r/w note 1 fffff8a0h dma terminal count output control register dtoc r/w ? 01h fffff8a8h dma interface control register difc r/w ? 00h fffffa00h uartb0 control register 0 ub0ctl0 r/w ? 10h fffffa02h uartb0 control register 2 ub0ctl2 r/w ffffh fffffa04h uartb0 status register ub0str r/w ? 00h fffffa06h uartb0 receive data register ap note 2 ub0rxap r 00ffh fffffa06h uartb0 receive data register ub0rx r ffh fffffa08h uartb0 transmit data register ub0tx w ffh fffffa0ah uartb0 fifo control register 0 ub0fic0 r/w ? 00h fffffa0bh uartb0 fifo control register 1 ub0fic1 r/w ? 00h fffffa0ch uartb0 fifo control register 2 ub0fic2 r/w 0000h fffffa0ch uartb0 fifo control register 2l ub0fic2l r/w 00h fffffa0dh uartb0 fifo control register 2h ub0fic2h r/w 00h fffffa0eh uartb0 fifo status register 0 ub0fis0 r 00h fffffa0fh uartb0 fifo status register 1 ub0fis1 r 10h fffffa20h uartb1 control register 0 ub1ctl0 r/w ? 10h fffffa22h uartb1 control register 2 ub1ctl2 r/w ffffh fffffa24h uartb1 status register ub1str r/w ? 00h fffffa26h uartb1 receive data register ap note 2 ub1rxap r 00ffh fffffa26h uartb1 receive data register ub1rx r ffh fffffa28h uartb1 transmit data register ub1tx w ffh fffffa2ah uartb1 fifo control register 0 ub1fic0 r/w ? 00h fffffa2bh uartb1 fifo control register 1 ub1fic1 r/w ? 00h notes 1. for details, see 8.3.3 sscg control register (sscgc) . 2. this register can be used only in fifo mode.
chapter 3 cpu function 95 preliminar y user ? s manual u16031ej2v1ud (11/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffffa2ch uartb1 fifo control register 2 ub1fic2 r/w 0000h fffffa2ch uartb1 fifo control register 2l ub1fic2l r/w 00h fffffa2dh uartb1 fifo control register 2h ub1fic2h r/w 00h fffffa2eh uartb1 fifo status register 0 ub1fis0 r 00h fffffa2fh uartb1 fifo status register 1 ub1fis1 r 10h fffffb00h pwm control register 0 pwmc0 r/w ? 08h fffffb02h pwm modulo register 0 pwm0 r/w 0000h fffffb02h pwm modulo register l0 pwml0 r/w 00h fffffb03h pwm modulo register h0 pwmh0 r/w 00h fffffb10h pwm control register 1 pwmc1 r/w ? 08h fffffb12h pwm modulo register 1 pwm1 r/w 0000h fffffb12h pwm modulo register l1 pwml1 r/w 00h fffffb13h pwm modulo register h1 pwmh1 r/w 00h fffffc02h external interrupt falling edge specification register 1 intf1 r/w ? 00h fffffc04h external interrupt falling edge specification register 2 intf2 r/w ? 00h fffffc0ah external interrupt falling edge specification register 5 intf5 r/w ? 00h fffffc0ch external interrupt falling edge specification register 6 intf6 r/w ? 00h fffffc10h external interrupt falling edge specification register al intfal r/w ? 00h fffffc16h external interrupt falling edge specification register dh intfdh r/w 0000h fffffc16h external interrupt falling edge specification register dhl intfdhl r/w ? 00h fffffc17h external interrupt falling edge specification register dhh intfdhh r/w ? 00h fffffc22h external interrupt rising edge specification register 1 intr1 r/w ? 03h fffffc24h external interrupt rising edge specification register 2 intr2 r/w ? 3fh fffffc2ah external interrupt rising edge specification register 5 intr5 r/w ? 07h fffffc2ch external interrupt rising edge specification register 6 intr6 r/w ? e0h fffffc30h external interrupt rising edge specification register al intral r/w ? 03h
chapter 3 cpu function 96 preliminar y user ? s manual u16031ej2v1ud (12/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffffc36h external interrupt rising edge specification register dh intrdh r/w ffffh fffffc36h external interrupt rising edge specification register dhl intrdhl r/w ? ffh fffffc37h external interrupt rising edge specification register dhh intrdhh r/w ? ffh fffffd00h clocked serial interface mode register 30 csim30 r/w ? 00h fffffd01h clocked serial interface clock select register 30 csic30 r/w ? 07h fffffd02h receive data buffer register 30 sirb30 r 0000h fffffd02h receive data buffer register 30l sirb30l r 00h fffffd03h receive data buffer register 30h sirb30h r 00h fffffd06h transmit data csi buffer register 30 sfdb30 r/w 0000h fffffd06h transmit data csi buffer register 30l sfdb30l r/w 00h fffffd07h transmit data csi buffer register 30h sfdb30h r/w 00h fffffd08h csibuf status register 30 sfa30 r/w ? 20h fffffd09h transfer data length select register 30 csil30 r/w ? 00h fffffd0ch transfer data number specification register 30 sfn30 r/w ? 00h fffffd20h clocked serial interface mode register 31 csim31 r/w ? 00h fffffd21h clocked serial interface clock select register 31 csic31 r/w ? 07h fffffd22h receive data buffer register 31 sirb31 r 0000h fffffd22h receive data buffer register 31l sirb31l r 00h fffffd23h receive data buffer register 31h sirb31h r 00h fffffd26h transmit data csi buffer register 31 sfdb31 r/w 0000h fffffd26h transmit data csi buffer register 31l sfdb31l r/w 00h fffffd27h transmit data csi buffer register 31h sfdb31h r/w 00h fffffd28h csibuf status register 31 sfa31 r/w ? 20h fffffd29h transfer data length select register 31 csil31 r/w ? 00h fffffd2ch transfer data number specification register 31 sfn31 r/w ? 00h fffffdf0h usb function 0 dma channel select register uf0cs r/w 0000h fffffdf2h usb function 0 buffer control register uf0bc r/w ? 00h fffffe00h uf0 ep0nak register uf0e0n r/w 00h fffffe01h uf0 ep0nakall register uf0e0na r/w 00h fffffe02h uf0 epnak register uf0en r/w 00h fffffe03h uf0 epnak mask register uf0enm r/w 00h fffffe04h uf0 sndsie register uf0sds r/w 00h fffffe05h uf0 clr request register uf0clr r 00h fffffe06h uf0 set request register uf0set r 00h fffffe07h uf0 ep status 0 register uf0eps0 r 00h
chapter 3 cpu function 97 preliminar y user ? s manual u16031ej2v1ud (13/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffffe08h uf0 ep status 1 register uf0eps1 r 00h fffffe09h uf0 ep status 2 register uf0eps2 r 00h fffffe10h uf0 int status 0 register uf0is0 r 00h fffffe11h uf0 int status 1 register uf0is1 r 00h fffffe12h uf0 int status 2 register uf0is2 r 00h fffffe13h uf0 int status 3 register uf0is3 r 00h fffffe14h uf0 int status 4 register uf0is4 r 00h fffffe17h uf0 int mask 0 register uf0im0 r/w 00h fffffe18h uf0 int mask 1 register uf0im1 r/w 00h fffffe19h uf0 int mask 2 register uf0im2 r/w 00h fffffe1ah uf0 int mask 3 register uf0im3 r/w 00h fffffe1bh uf0 int mask 4 register uf0im4 r/w 00h fffffe1eh uf0 int clear 0 register uf0ic0 w ffh fffffe1fh uf0 int clear 1 register uf0ic1 w ffh fffffe20h uf0 int clear 2 register uf0ic2 w ffh fffffe21h uf0 int clear 3 register uf0ic3 w ffh fffffe22h uf0 int clear 4 register uf0ic4 w ffh fffffe26h uf0 int & dmarq register uf0idr r/w 00h fffffe27h uf0 dma status 0 register uf0dms0 r 00h fffffe28h uf0 dma status 1 register uf0dms1 r 00h fffffe30h uf0 fifo clear 0 register uf0fic0 w 00h fffffe31h uf0 fifo clear 1 register uf0fic1 w 00h fffffe35h uf0 data end register uf0dend r/w 00h fffffe37h uf0 gpr register uf0gpr r/w 00h fffffe3ah uf0 mode control register uf0modc r/w 00h fffffe3ch uf0 mode status register uf0mods r 00h fffffe40h uf0 active interface number register uf0aifn r/w 00h fffffe41h uf0 active alternative setting register uf0aas r/w 00h fffffe42h uf0 alternative setting status register uf0ass r 00h fffffe43h uf0 endpoint 1 interface mapping register uf0e1im r/w 00h fffffe44h uf0 endpoint 2 interface mapping register uf0e2im r/w 00h fffffe45h uf0 endpoint 3 interface mapping register uf0e3im r/w 00h fffffe46h uf0 endpoint 4 interface mapping register uf0e4im r/w 00h fffffe49h uf0 endpoint 7 interface mapping register uf0e7im r/w 00h fffffe4ah uf0 endpoint 8 interface mapping register uf0e8im r/w 00h fffffe80h uf0 ep0 read register uf0e0r r undefined fffffe81h uf0 ep0 length register uf0e0l r 00h fffffe82h uf0 ep0 setup register uf0e0st r 00h
chapter 3 cpu function 98 preliminar y user ? s manual u16031ej2v1ud (14/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffffe83h uf0 ep0 write register uf0e0w w undefined fffffe84h uf0 bulk out 1 register uf0bo1 r undefined fffffe85h uf0 bulk out 1 length register uf0bo1l r 00h fffffe86h uf0 bulk out 2 register uf0bo2 r undefined fffffe87h uf0 bulk out 2 length register uf0bo2l r 00h fffffe88h uf0 bulk in 1 register uf0bi1 w undefined fffffe89h uf0 bulk in 2 register uf0bi2 w undefined fffffe8ah uf0 interrupt 1 register uf0int1 w undefined fffffe8bh uf0 interrupt 2 register uf0int2 w undefined fffffea2h uf0 device status register l uf0dstl r/w 00h fffffea6h uf0 ep0 status register l uf0e0sl r/w 00h fffffea8h uf0 ep1 status register l uf0e1sl r/w 00h fffffeaah uf0 ep2 status register l uf0e2sl r/w 00h fffffeach uf0 ep3 status register l uf0e3sl r/w 00h fffffeaeh uf0 ep4 status register l uf0e4sl r/w 00h fffffeb4h uf0 ep7 status register l uf0e7sl r/w 00h fffffeb6h uf0 ep8 status register l uf0e8sl r/w 00h fffffec0h uf0 address register uf0adrs r 00h fffffec1h uf0 configuration register uf0cnf r 00h fffffec2h uf0 interface 0 register uf0if0 r 00h fffffec3h uf0 interface 1 register uf0if1 r 00h fffffec4h uf0 interface 2 register uf0if2 r 00h fffffec5h uf0 interface 3 register uf0if3 r 00h fffffec6h uf0 interface 4 register uf0if4 r 00h fffffed0h uf0 descriptor length register uf0dscl r/w 00h fffffed1h uf0 device descriptor register 0 uf0dd0 r/w undefined fffffed2h uf0 device descriptor register 1 uf0dd1 r/w undefined fffffed3h uf0 device descriptor register 2 uf0dd2 r/w undefined fffffed4h uf0 device descriptor register 3 uf0dd3 r/w undefined fffffed5h uf0 device descriptor register 4 uf0dd4 r/w undefined fffffed6h uf0 device descriptor register 5 uf0dd5 r/w undefined fffffed7h uf0 device descriptor register 6 uf0dd6 r/w undefined fffffed8h uf0 device descriptor register 7 uf0dd7 r/w undefined fffffed9h uf0 device descriptor register 8 uf0dd8 r/w undefined fffffedah uf0 device descriptor register 9 uf0dd9 r/w undefined fffffedbh uf0 device descriptor register 10 uf0dd10 r/w undefined fffffedch uf0 device descriptor register 11 uf0dd11 r/w undefined fffffeddh uf0 device descriptor register 12 uf0dd12 r/w undefined
chapter 3 cpu function 99 preliminar y user ? s manual u16031ej2v1ud (15/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffffedeh uf0 device descriptor register 13 uf0dd13 r/w undefined fffffedfh uf0 device descriptor register 14 uf0dd14 r/w undefined fffffee0h uf0 device descriptor register 15 uf0dd15 r/w undefined fffffee1h uf0 device descriptor register 16 uf0dd16 r/w undefined fffffee2h uf0 device descriptor register 17 uf0dd17 r/w undefined fffffee3h uf0 configuration/interface/ endpoint descriptor register 0 uf0cie0 r/w undefined fffffee4h uf0 configuration/interface/ endpoint descriptor register 1 uf0cie1 r/w undefined fffffee5h uf0 configuration/interface/ endpoint descriptor register 2 uf0cie2 r/w undefined fffffee6h uf0 configuration/interface/ endpoint descriptor register 3 uf0cie3 r/w undefined fffffee7h uf0 configuration/interface/ endpoint descriptor register 4 uf0cie4 r/w undefined fffffee8h uf0 configuration/interface/ endpoint descriptor register 5 uf0cie5 r/w undefined fffffee9h uf0 configuration/interface/ endpoint descriptor register 6 uf0cie6 r/w undefined fffffeeah uf0 configuration/interface/ endpoint descriptor register 7 uf0cie7 r/w undefined fffffeebh uf0 configuration/interface/ endpoint descriptor register 8 uf0cie8 r/w undefined fffffeech uf0 configuration/interface/ endpoint descriptor register 9 uf0cie9 r/w undefined fffffeedh uf0 configuration/interface/ endpoint descriptor register 10 uf0cie10 r/w undefined fffffeeeh uf0 configuration/interface/ endpoint descriptor register 11 uf0cie11 r/w undefined fffffeefh uf0 configuration/interface/ endpoint descriptor register 12 uf0cie12 r/w undefined fffffef0h uf0 configuration/interface/ endpoint descriptor register 13 uf0cie13 r/w undefined fffffef1h uf0 configuration/interface/ endpoint descriptor register 14 uf0cie14 r/w undefined fffffef2h uf0 configuration/interface/ endpoint descriptor register 15 uf0cie15 r/w undefined fffffef3h uf0 configuration/interface/ endpoint descriptor register 16 uf0cie16 r/w undefined fffffef4h uf0 configuration/interface/ endpoint descriptor register 17 uf0cie17 r/w undefined fffffef5h uf0 configuration/interface/ endpoint descriptor register 18 uf0cie18 r/w undefined
chapter 3 cpu function 100 preliminar y user ? s manual u16031ej2v1ud (16/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset fffffef6h uf0 configuration/interface/ endpoint descriptor register 19 uf0cie19 r/w undefined fffffef7h uf0 configuration/interface/ endpoint descriptor register 20 uf0cie20 r/w undefined fffffef8h uf0 configuration/interface/ endpoint descriptor register 21 uf0cie21 r/w undefined fffffef9h uf0 configuration/interface/ endpoint descriptor register 22 uf0cie22 r/w undefined fffffefah uf0 configuration/interface/ endpoint descriptor register 23 uf0cie23 r/w undefined fffffefbh uf0 configuration/interface/ endpoint descriptor register 24 uf0cie24 r/w undefined fffffefch uf0 configuration/interface/ endpoint descriptor register 25 uf0cie25 r/w undefined fffffefdh uf0 configuration/interface/ endpoint descriptor register 26 uf0cie26 r/w undefined fffffefeh uf0 configuration/interface/ endpoint descriptor register 27 uf0cie27 r/w undefined fffffeffh uf0 configuration/interface/ endpoint descriptor register 28 uf0cie28 r/w undefined ffffff00h uf0 configuration/interface/ endpoint descriptor register 29 uf0cie29 r/w undefined ffffff01h uf0 configuration/interface/ endpoint descriptor register 30 uf0cie30 r/w undefined ffffff02h uf0 configuration/interface/ endpoint descriptor register 31 uf0cie31 r/w undefined ffffff03h uf0 configuration/interface/ endpoint descriptor register 32 uf0cie32 r/w undefined ffffff04h uf0 configuration/interface/ endpoint descriptor register 33 uf0cie33 r/w undefined ffffff05h uf0 configuration/interface/ endpoint descriptor register 34 uf0cie34 r/w undefined ffffff06h uf0 configuration/interface/ endpoint descriptor register 35 uf0cie35 r/w undefined ffffff07h uf0 configuration/interface/ endpoint descriptor register 36 uf0cie36 r/w undefined ffffff08h uf0 configuration/interface/ endpoint descriptor register 37 uf0cie37 r/w undefined ffffff09h uf0 configuration/interface/ endpoint descriptor register 38 uf0cie38 r/w undefined ffffff0ah uf0 configuration/interface/ endpoint descriptor register 39 uf0cie39 r/w undefined ffffff0bh uf0 configuration/interface/ endpoint descriptor register 40 uf0cie40 r/w undefined
chapter 3 cpu function 101 preliminar y user ? s manual u16031ej2v1ud (17/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffff0ch uf0 configuration/interface/ endpoint descriptor register 41 uf0cie41 r/w undefined ffffff0dh uf0 configuration/interface/ endpoint descriptor register 42 uf0cie42 r/w undefined ffffff0eh uf0 configuration/interface/ endpoint descriptor register 43 uf0cie43 r/w undefined ffffff0fh uf0 configuration/interface/ endpoint descriptor register 44 uf0cie44 r/w undefined ffffff10h uf0 configuration/interface/ endpoint descriptor register 45 uf0cie45 r/w undefined ffffff11h uf0 configuration/interface/ endpoint descriptor register 46 uf0cie46 r/w undefined ffffff12h uf0 configuration/interface/ endpoint descriptor register 47 uf0cie47 r/w undefined ffffff13h uf0 configuration/interface/ endpoint descriptor register 48 uf0cie48 r/w undefined ffffff14h uf0 configuration/interface/ endpoint descriptor register 49 uf0cie49 r/w undefined ffffff15h uf0 configuration/interface/ endpoint descriptor register 50 uf0cie50 r/w undefined ffffff16h uf0 configuration/interface/ endpoint descriptor register 51 uf0cie51 r/w undefined ffffff17h uf0 configuration/interface/ endpoint descriptor register 52 uf0cie52 r/w undefined ffffff18h uf0 configuration/interface/ endpoint descriptor register 53 uf0cie53 r/w undefined ffffff19h uf0 configuration/interface/ endpoint descriptor register 54 uf0cie54 r/w undefined ffffff1ah uf0 configuration/interface/ endpoint descriptor register 55 uf0cie55 r/w undefined ffffff1bh uf0 configuration/interface/ endpoint descriptor register 56 uf0cie56 r/w undefined ffffff1ch uf0 configuration/interface/ endpoint descriptor register 57 uf0cie57 r/w undefined ffffff1dh uf0 configuration/interface/ endpoint descriptor register 58 uf0cie58 r/w undefined ffffff1eh uf0 configuration/interface/ endpoint descriptor register 59 uf0cie59 r/w undefined ffffff1fh uf0 configuration/interface/ endpoint descriptor register 60 uf0cie60 r/w undefined ffffff20h uf0 configuration/interface/ endpoint descriptor register 61 uf0cie61 r/w undefined ffffff21h uf0 configuration/interface/ endpoint descriptor register 62 uf0cie62 r/w undefined
chapter 3 cpu function 102 preliminar y user ? s manual u16031ej2v1ud (18/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffff22h uf0 configuration/interface/ endpoint descriptor register 63 uf0cie63 r/w undefined ffffff23h uf0 configuration/interface/ endpoint descriptor register 64 uf0cie64 r/w undefined ffffff24h uf0 configuration/interface/ endpoint descriptor register 65 uf0cie65 r/w undefined ffffff25h uf0 configuration/interface/ endpoint descriptor register 66 uf0cie66 r/w undefined ffffff26h uf0 configuration/interface/ endpoint descriptor register 67 uf0cie67 r/w undefined ffffff27h uf0 configuration/interface/ endpoint descriptor register 68 uf0cie68 r/w undefined ffffff28h uf0 configuration/interface/ endpoint descriptor register 69 uf0cie69 r/w undefined ffffff29h uf0 configuration/interface/ endpoint descriptor register 70 uf0cie70 r/w undefined ffffff2ah uf0 configuration/interface/ endpoint descriptor register 71 uf0cie71 r/w undefined ffffff2bh uf0 configuration/interface/ endpoint descriptor register 72 uf0cie72 r/w undefined ffffff2ch uf0 configuration/interface/ endpoint descriptor register 73 uf0cie73 r/w undefined ffffff2dh uf0 configuration/interface/ endpoint descriptor register 74 uf0cie74 r/w undefined ffffff2eh uf0 configuration/interface/ endpoint descriptor register 75 uf0cie75 r/w undefined ffffff2fh uf0 configuration/interface/ endpoint descriptor register 76 uf0cie76 r/w undefined ffffff30h uf0 configuration/interface/ endpoint descriptor register 77 uf0cie77 r/w undefined ffffff31h uf0 configuration/interface/ endpoint descriptor register 78 uf0cie78 r/w undefined ffffff32h uf0 configuration/interface/ endpoint descriptor register 79 uf0cie79 r/w undefined ffffff33h uf0 configuration/interface/ endpoint descriptor register 80 uf0cie80 r/w undefined ffffff34h uf0 configuration/interface/ endpoint descriptor register 81 uf0cie81 r/w undefined ffffff35h uf0 configuration/interface/ endpoint descriptor register 82 uf0cie82 r/w undefined ffffff36h uf0 configuration/interface/ endpoint descriptor register 83 uf0cie83 r/w undefined ffffff37h uf0 configuration/interface/ endpoint descriptor register 84 uf0cie84 r/w undefined
chapter 3 cpu function 103 preliminar y user ? s manual u16031ej2v1ud (19/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffff38h uf0 configuration/interface/ endpoint descriptor register 85 uf0cie85 r/w undefined ffffff39h uf0 configuration/interface/ endpoint descriptor register 86 uf0cie86 r/w undefined ffffff3ah uf0 configuration/interface/ endpoint descriptor register 87 uf0cie87 r/w undefined ffffff3bh uf0 configuration/interface/ endpoint descriptor register 88 uf0cie88 r/w undefined ffffff3ch uf0 configuration/interface/ endpoint descriptor register 89 uf0cie89 r/w undefined ffffff3dh uf0 configuration/interface/ endpoint descriptor register 90 uf0cie90 r/w undefined ffffff3eh uf0 configuration/interface/ endpoint descriptor register 91 uf0cie91 r/w undefined ffffff3fh uf0 configuration/interface/ endpoint descriptor register 92 uf0cie92 r/w undefined ffffff40h uf0 configuration/interface/ endpoint descriptor register 93 uf0cie93 r/w undefined ffffff41h uf0 configuration/interface/ endpoint descriptor register 94 uf0cie94 r/w undefined ffffff42h uf0 configuration/interface/ endpoint descriptor register 95 uf0cie95 r/w undefined ffffff43h uf0 configuration/interface/ endpoint descriptor register 96 uf0cie96 r/w undefined ffffff44h uf0 configuration/interface/ endpoint descriptor register 97 uf0cie97 r/w undefined ffffff45h uf0 configuration/interface/ endpoint descriptor register 98 uf0cie98 r/w undefined ffffff46h uf0 configuration/interface/ endpoint descriptor register 99 uf0cie99 r/w undefined ffffff47h uf0 configuration/interface/ endpoint descriptor register 100 uf0cie100 r/w undefined ffffff48h uf0 configuration/interface/ endpoint descriptor register 101 uf0cie101 r/w undefined ffffff49h uf0 configuration/interface/ endpoint descriptor register 102 uf0cie102 r/w undefined ffffff4ah uf0 configuration/interface/ endpoint descriptor register 103 uf0cie103 r/w undefined ffffff4bh uf0 configuration/interface/ endpoint descriptor register 104 uf0cie104 r/w undefined ffffff4ch uf0 configuration/interface/ endpoint descriptor register 105 uf0cie105 r/w undefined ffffff4dh uf0 configuration/interface/ endpoint descriptor register 106 uf0cie106 r/w undefined
chapter 3 cpu function 104 preliminar y user ? s manual u16031ej2v1ud (20/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffff4eh uf0 configuration/interface/ endpoint descriptor register 107 uf0cie107 r/w undefined ffffff4fh uf0 configuration/interface/ endpoint descriptor register 108 uf0cie108 r/w undefined ffffff50h uf0 configuration/interface/ endpoint descriptor register 109 uf0cie109 r/w undefined ffffff51h uf0 configuration/interface/ endpoint descriptor register 110 uf0cie110 r/w undefined ffffff52h uf0 configuration/interface/ endpoint descriptor register 111 uf0cie111 r/w undefined ffffff53h uf0 configuration/interface/ endpoint descriptor register 112 uf0cie112 r/w undefined ffffff54h uf0 configuration/interface/ endpoint descriptor register 113 uf0cie113 r/w undefined ffffff55h uf0 configuration/interface/ endpoint descriptor register 114 uf0cie114 r/w undefined ffffff56h uf0 configuration/interface/ endpoint descriptor register 115 uf0cie115 r/w undefined ffffff57h uf0 configuration/interface/ endpoint descriptor register 116 uf0cie116 r/w undefined ffffff58h uf0 configuration/interface/ endpoint descriptor register 117 uf0cie117 r/w undefined ffffff59h uf0 configuration/interface/ endpoint descriptor register 118 uf0cie118 r/w undefined ffffff5ah uf0 configuration/interface/ endpoint descriptor register 119 uf0cie119 r/w undefined ffffff5bh uf0 configuration/interface/ endpoint descriptor register 120 uf0cie120 r/w undefined ffffff5ch uf0 configuration/interface/ endpoint descriptor register 121 uf0cie121 r/w undefined ffffff5dh uf0 configuration/interface/ endpoint descriptor register 122 uf0cie122 r/w undefined ffffff5eh uf0 configuration/interface/ endpoint descriptor register 123 uf0cie123 r/w undefined ffffff5fh uf0 configuration/interface/ endpoint descriptor register 124 uf0cie124 r/w undefined ffffff60h uf0 configuration/interface/ endpoint descriptor register 125 uf0cie125 r/w undefined ffffff61h uf0 configuration/interface/ endpoint descriptor register 126 uf0cie126 r/w undefined ffffff62h uf0 configuration/interface/ endpoint descriptor register 127 uf0cie127 r/w undefined ffffff63h uf0 configuration/interface/ endpoint descriptor register 128 uf0cie128 r/w undefined
chapter 3 cpu function 105 preliminar y user ? s manual u16031ej2v1ud (21/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffff64h uf0 configuration/interface/ endpoint descriptor register 129 uf0cie129 r/w undefined ffffff65h uf0 configuration/interface/ endpoint descriptor register 130 uf0cie130 r/w undefined ffffff66h uf0 configuration/interface/ endpoint descriptor register 131 uf0cie131 r/w undefined ffffff67h uf0 configuration/interface/ endpoint descriptor register 132 uf0cie132 r/w undefined ffffff68h uf0 configuration/interface/ endpoint descriptor register 133 uf0cie133 r/w undefined ffffff69h uf0 configuration/interface/ endpoint descriptor register 134 uf0cie134 r/w undefined ffffff6ah uf0 configuration/interface/ endpoint descriptor register 135 uf0cie135 r/w undefined ffffff6bh uf0 configuration/interface/ endpoint descriptor register 136 uf0cie136 r/w undefined ffffff6ch uf0 configuration/interface/ endpoint descriptor register 137 uf0cie137 r/w undefined ffffff6dh uf0 configuration/interface/ endpoint descriptor register 138 uf0cie138 r/w undefined ffffff6eh uf0 configuration/interface/ endpoint descriptor register 139 uf0cie139 r/w undefined ffffff6fh uf0 configuration/interface/ endpoint descriptor register 140 uf0cie140 r/w undefined ffffff70h uf0 configuration/interface/ endpoint descriptor register 141 uf0cie141 r/w undefined ffffff71h uf0 configuration/interface/ endpoint descriptor register 142 uf0cie142 r/w undefined ffffff72h uf0 configuration/interface/ endpoint descriptor register 143 uf0cie143 r/w undefined ffffff73h uf0 configuration/interface/ endpoint descriptor register 144 uf0cie144 r/w undefined ffffff74h uf0 configuration/interface/ endpoint descriptor register 145 uf0cie145 r/w undefined ffffff75h uf0 configuration/interface/ endpoint descriptor register 146 uf0cie146 r/w undefined ffffff76h uf0 configuration/interface/ endpoint descriptor register 147 uf0cie147 r/w undefined ffffff77h uf0 configuration/interface/ endpoint descriptor register 148 uf0cie148 r/w undefined ffffff78h uf0 configuration/interface/ endpoint descriptor register 149 uf0cie149 r/w undefined ffffff79h uf0 configuration/interface/ endpoint descriptor register 150 uf0cie150 r/w undefined
chapter 3 cpu function 106 preliminar y user ? s manual u16031ej2v1ud (22/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffff7ah uf0 configuration/interface/ endpoint descriptor register 151 uf0cie151 r/w undefined ffffff7bh uf0 configuration/interface/ endpoint descriptor register 152 uf0cie152 r/w undefined ffffff7ch uf0 configuration/interface/ endpoint descriptor register 153 uf0cie153 r/w undefined ffffff7dh uf0 configuration/interface/ endpoint descriptor register 154 uf0cie154 r/w undefined ffffff7eh uf0 configuration/interface/ endpoint descriptor register 155 uf0cie155 r/w undefined ffffff7fh uf0 configuration/interface/ endpoint descriptor register 156 uf0cie156 r/w undefined ffffff80h uf0 configuration/interface/ endpoint descriptor register 157 uf0cie157 r/w undefined ffffff81h uf0 configuration/interface/ endpoint descriptor register 158 uf0cie158 r/w undefined ffffff82h uf0 configuration/interface/ endpoint descriptor register 159 uf0cie159 r/w undefined ffffff83h uf0 configuration/interface/ endpoint descriptor register 160 uf0cie160 r/w undefined ffffff84h uf0 configuration/interface/ endpoint descriptor register 161 uf0cie161 r/w undefined ffffff85h uf0 configuration/interface/ endpoint descriptor register 162 uf0cie162 r/w undefined ffffff86h uf0 configuration/interface/ endpoint descriptor register 163 uf0cie163 r/w undefined ffffff87h uf0 configuration/interface/ endpoint descriptor register 164 uf0cie164 r/w undefined ffffff88h uf0 configuration/interface/ endpoint descriptor register 165 uf0cie165 r/w undefined ffffff89h uf0 configuration/interface/ endpoint descriptor register 166 uf0cie166 r/w undefined ffffff8ah uf0 configuration/interface/ endpoint descriptor register 167 uf0cie167 r/w undefined ffffff8bh uf0 configuration/interface/ endpoint descriptor register 168 uf0cie168 r/w undefined ffffff8ch uf0 configuration/interface/ endpoint descriptor register 169 uf0cie169 r/w undefined ffffff8dh uf0 configuration/interface/ endpoint descriptor register 170 uf0cie170 r/w undefined ffffff8eh uf0 configuration/interface/ endpoint descriptor register 171 uf0cie171 r/w undefined ffffff8fh uf0 configuration/interface/ endpoint descriptor register 172 uf0cie172 r/w undefined
chapter 3 cpu function 107 preliminar y user ? s manual u16031ej2v1ud (23/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffff90h uf0 configuration/interface/ endpoint descriptor register 173 uf0cie173 r/w undefined ffffff91h uf0 configuration/interface/ endpoint descriptor register 174 uf0cie174 r/w undefined ffffff92h uf0 configuration/interface/ endpoint descriptor register 175 uf0cie175 r/w undefined ffffff93h uf0 configuration/interface/ endpoint descriptor register 176 uf0cie176 r/w undefined ffffff94h uf0 configuration/interface/ endpoint descriptor register 177 uf0cie177 r/w undefined ffffff95h uf0 configuration/interface/ endpoint descriptor register 178 uf0cie178 r/w undefined ffffff96h uf0 configuration/interface/ endpoint descriptor register 179 uf0cie179 r/w undefined ffffff97h uf0 configuration/interface/ endpoint descriptor register 180 uf0cie180 r/w undefined ffffff98h uf0 configuration/interface/ endpoint descriptor register 181 uf0cie181 r/w undefined ffffff99h uf0 configuration/interface/ endpoint descriptor register 182 uf0cie182 r/w undefined ffffff9ah uf0 configuration/interface/ endpoint descriptor register 183 uf0cie183 r/w undefined ffffff9bh uf0 configuration/interface/ endpoint descriptor register 184 uf0cie184 r/w undefined ffffff9ch uf0 configuration/interface/ endpoint descriptor register 185 uf0cie185 r/w undefined ffffff9dh uf0 configuration/interface/ endpoint descriptor register 186 uf0cie186 r/w undefined ffffff9eh uf0 configuration/interface/ endpoint descriptor register 187 uf0cie187 r/w undefined ffffff9fh uf0 configuration/interface/ endpoint descriptor register 188 uf0cie188 r/w undefined ffffffa0h uf0 configuration/interface/ endpoint descriptor register 189 uf0cie189 r/w undefined ffffffa1h uf0 configuration/interface/ endpoint descriptor register 190 uf0cie190 r/w undefined ffffffa2h uf0 configuration/interface/ endpoint descriptor register 191 uf0cie191 r/w undefined ffffffa3h uf0 configuration/interface/ endpoint descriptor register 192 uf0cie192 r/w undefined ffffffa4h uf0 configuration/interface/ endpoint descriptor register 193 uf0cie193 r/w undefined ffffffa5h uf0 configuration/interface/ endpoint descriptor register 194 uf0cie194 r/w undefined
chapter 3 cpu function 108 preliminar y user ? s manual u16031ej2v1ud (24/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffffa6h uf0 configuration/interface/ endpoint descriptor register 195 uf0cie195 r/w undefined ffffffa7h uf0 configuration/interface/ endpoint descriptor register 196 uf0cie196 r/w undefined ffffffa8h uf0 configuration/interface/ endpoint descriptor register 197 uf0cie197 r/w undefined ffffffa9h uf0 configuration/interface/ endpoint descriptor register 198 uf0cie198 r/w undefined ffffffaah uf0 configuration/interface/ endpoint descriptor register 199 uf0cie199 r/w undefined ffffffabh uf0 configuration/interface/ endpoint descriptor register 200 uf0cie200 r/w undefined ffffffach uf0 configuration/interface/ endpoint descriptor register 201 uf0cie201 r/w undefined ffffffadh uf0 configuration/interface/ endpoint descriptor register 202 uf0cie202 r/w undefined ffffffaeh uf0 configuration/interface/ endpoint descriptor register 203 uf0cie203 r/w undefined ffffffafh uf0 configuration/interface/ endpoint descriptor register 204 uf0cie204 r/w undefined ffffffb0h uf0 configuration/interface/ endpoint descriptor register 205 uf0cie205 r/w undefined ffffffb1h uf0 configuration/interface/ endpoint descriptor register 206 uf0cie206 r/w undefined ffffffb2h uf0 configuration/interface/ endpoint descriptor register 207 uf0cie207 r/w undefined ffffffb3h uf0 configuration/interface/ endpoint descriptor register 208 uf0cie208 r/w undefined ffffffb4h uf0 configuration/interface/ endpoint descriptor register 209 uf0cie209 r/w undefined ffffffb5h uf0 configuration/interface/ endpoint descriptor register 210 uf0cie210 r/w undefined ffffffb6h uf0 configuration/interface/ endpoint descriptor register 211 uf0cie211 r/w undefined ffffffb7h uf0 configuration/interface/ endpoint descriptor register 212 uf0cie212 r/w undefined ffffffb8h uf0 configuration/interface/ endpoint descriptor register 213 uf0cie213 r/w undefined ffffffb9h uf0 configuration/interface/ endpoint descriptor register 214 uf0cie214 r/w undefined ffffffbah uf0 configuration/interface/ endpoint descriptor register 215 uf0cie215 r/w undefined ffffffbbh uf0 configuration/interface/ endpoint descriptor register 216 uf0cie216 r/w undefined
chapter 3 cpu function 109 preliminar y user ? s manual u16031ej2v1ud (25/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffffbch uf0 configuration/interface/ endpoint descriptor register 217 uf0cie217 r/w undefined ffffffbdh uf0 configuration/interface/ endpoint descriptor register 218 uf0cie218 r/w undefined ffffffbeh uf0 configuration/interface/ endpoint descriptor register 219 uf0cie219 r/w undefined ffffffbfh uf0 configuration/interface/ endpoint descriptor register 220 uf0cie220 r/w undefined ffffffc0h uf0 configuration/interface/ endpoint descriptor register 221 uf0cie221 r/w undefined ffffffc1h uf0 configuration/interface/ endpoint descriptor register 222 uf0cie222 r/w undefined ffffffc2h uf0 configuration/interface/ endpoint descriptor register 223 uf0cie223 r/w undefined ffffffc3h uf0 configuration/interface/ endpoint descriptor register 224 uf0cie224 r/w undefined ffffffc4h uf0 configuration/interface/ endpoint descriptor register 225 uf0cie225 r/w undefined ffffffc5h uf0 configuration/interface/ endpoint descriptor register 226 uf0cie226 r/w undefined ffffffc6h uf0 configuration/interface/ endpoint descriptor register 227 uf0cie227 r/w undefined ffffffc7h uf0 configuration/interface/ endpoint descriptor register 228 uf0cie228 r/w undefined ffffffc8h uf0 configuration/interface/ endpoint descriptor register 229 uf0cie229 r/w undefined ffffffc9h uf0 configuration/interface/ endpoint descriptor register 230 uf0cie230 r/w undefined ffffffcah uf0 configuration/interface/ endpoint descriptor register 231 uf0cie231 r/w undefined ffffffcbh uf0 configuration/interface/ endpoint descriptor register 232 uf0cie232 r/w undefined ffffffcch uf0 configuration/interface/ endpoint descriptor register 233 uf0cie233 r/w undefined ffffffcdh uf0 configuration/interface/ endpoint descriptor register 234 uf0cie234 r/w undefined ffffffceh uf0 configuration/interface/ endpoint descriptor register 235 uf0cie235 r/w undefined ffffffcfh uf0 configuration/interface/ endpoint descriptor register 236 uf0cie236 r/w undefined ffffffd0h uf0 configuration/interface/ endpoint descriptor register 237 uf0cie237 r/w undefined ffffffd1h uf0 configuration/interface/ endpoint descriptor register 238 uf0cie238 r/w undefined
chapter 3 cpu function 110 preliminar y user ? s manual u16031ej2v1ud (26/26) bit units for manipulation address function register name symbol r/w 1 bit 8 bits 16 bits after reset ffffffd2h uf0 configuration/interface/ endpoint descriptor register 239 uf0cie239 r/w undefined ffffffd3h uf0 configuration/interface/ endpoint descriptor register 240 uf0cie240 r/w undefined ffffffd4h uf0 configuration/interface/ endpoint descriptor register 241 uf0cie241 r/w undefined ffffffd5h uf0 configuration/interface/ endpoint descriptor register 242 uf0cie242 r/w undefined ffffffd6h uf0 configuration/interface/ endpoint descriptor register 243 uf0cie243 r/w undefined ffffffd7h uf0 configuration/interface/ endpoint descriptor register 244 uf0cie244 r/w undefined ffffffd8h uf0 configuration/interface/ endpoint descriptor register 245 uf0cie245 r/w undefined ffffffd9h uf0 configuration/interface/ endpoint descriptor register 246 uf0cie246 r/w undefined ffffffdah uf0 configuration/interface/ endpoint descriptor register 247 uf0cie247 r/w undefined ffffffdbh uf0 configuration/interface/ endpoint descriptor register 248 uf0cie248 r/w undefined ffffffdch uf0 configuration/interface/ endpoint descriptor register 249 uf0cie249 r/w undefined ffffffddh uf0 configuration/interface/ endpoint descriptor register 250 uf0cie250 r/w undefined ffffffdeh uf0 configuration/interface/ endpoint descriptor register 251 uf0cie251 r/w undefined ffffffdfh uf0 configuration/interface/ endpoint descriptor register 252 uf0cie252 r/w undefined ffffffe0h uf0 configuration/interface/ endpoint descriptor register 253 uf0cie253 r/w undefined ffffffe1h uf0 configuration/interface/ endpoint descriptor register 254 uf0cie254 r/w undefined ffffffe2h uf0 configuration/interface/ endpoint descriptor register 255 uf0cie255 r/w undefined
chapter 3 cpu function 111 preliminar y user ? s manual u16031ej2v1ud 3.4.8 specific registers specific registers are registers that are protected from being written with illegal data due to erroneous program execution, etc. the v850e/me2 has four specific registers, the power-save control register (psc) (see 8.6.2 (3) power-save control register (psc) ), clock control register (ckc) (see 8.3.1 clock control register (ckc) ), clock source select register (cks) (see 8.3.2 clock source select register (cks) ), and sscg control register (sscgc) (see 8.3.3 sscg control register (sscgc) ). disable dma transfer when writing to a specific register. there is also the command register (prcmd), a protection register supporting write operations for specific registers to avoid an unexpected stoppage of the application system due to erroneous program execution (see 8.6.2 (2) command register (prcmd) ). 3.4.9 system wait control register (vswc) the system wait control register (vswc) is a register that controls the bus access wait for the on-chip peripheral i/o registers. access to on-chip peripheral i/o registers is made in 3 clocks (without wait), however, in the v850e/me2 waits may be required depending on the operation frequency. set the values described in the table below to the vswc in accordance with the operation frequency used. this register can be read or written in 1-bit or 8-bit units (address: fffff06eh, initial value: 77h). operation frequency (f x ) vswc setting value 10.00 mhz f x 25.00 mhz 00 25.00 mhz < f x 34.00 mhz 10 34.00 mhz < f x 68.00 mhz 11 68.00 mhz < f x 75.00 mhz 12 75.00 mhz < f x 103.00 mhz 22 103.00 mhz < f x 125.00 mhz 23 125.00 mhz < f x 150.00 mhz 33 remark if the timing of changing a count value contend with the timing of accessing a register when accessing a register having status flags that indicate the status of the on-chip peripheral functions (such as ubnstr) or a register that indicates the count value of a timer (such as tmcn), the register access is retried. as a result, it may take a longer time to access an on-chip peripheral i/o register.
chapter 3 cpu function 112 preliminar y user ? s manual u16031ej2v1ud 3.4.10 initialization sequence initialize the v850e/me2 in the following sequence. <1> automatically branch to address 100000h after reset is cleared set the following registers that affect the external bus access performance using the program located at address 100000h. execution automatically branches to 100000h when the reset signal is input in the power-on status. ? system wait control register (vswc) setting of a wait cycle for accessing the on-chip peripheral i/o ? data wait control registers 0 and 1 (dwc0 and dwc1) setting of a data wait cycle of the external bus ? address setup wait control register (asc) setting of an address setup wait cycle of the external bus ? bus cycle control register (bcc) setting of an idle state of the external bus as necessary, set chip area select control registers 0 and 1 (csc0 and csc1), bus cycle type configuration registers 0 and 1 (bct0 and bct1), the local bus sizing control register (lbs), the endian configuration register (bec), line buffer control registers 0 and 1 (lbc0 and lbc1), and the page rom configuration register (prc). cautions 1. disable all interrupts from when the reset signal is cleared until when the program code is completely transferred to the internal instruction ram (while steps <1> to <3> of the initialization sequence are being executed). maskable interrupts are masked by default and do not have to be disabled. 2. set sdram configuration registers 1, 3, 4, and 6 (scr1, scr3, scr4, and scr6) after the processing of step <2>. <2> checking lock bit of lock register (lockr) after setting the registers in <1> above, check whether the lock bit of the lockr register is cleared to 0 (pll is locked), and set the registers as follows. (i) system wait control register (vswc) set to x7h (x: value set in <1>) for example, if 11h is set in <1>, set 17h here. (ii) bus mode control register (bmc) set the frequency division value of the external bus. (iii) system wait control register (vswc) re-set the value set in <1>. (iv) clock control register (ckc) set the internal system clock frequency division value. (v) clock source select register (cks) switch from osc output to sscg output (switch the clock supply to the cpu from the input frequency to the x1 and x2 pins to the frequency multiplied by 8 by the pll). remark the ckc and cks registers must be rewritten in a special sequence because they are specific registers.
chapter 3 cpu function 113 preliminar y user ? s manual u16031ej2v1ud <3> transferring program code to internal instruction ram transfer the program code to the internal instruction ram by program processing or using the dma function. when using the dma function, check the completion of dma transfer by polling bit 7 (dmaifn) of the dma interrupt control register (dmaicn), without using the dma transfer end interrupt (intdman) (n = 0 to 3). after transferring the program code, set the internal instruction ram in the read mode using the following procedure. (i) set the read mode by using (clearing to 0) the iramm0 bit of the internal instruction ram mode register (iramm). note that the setting of the iramm0 bit must not be changed before it is cleared here. (ii) after clearing the iramm0 bit of the iramm register to 0, read the iramm0 bit that has been cleared to 0 to confirm that the read mode has been set (to prevent speculative instruction execution by pipeline operation). (iii) branch to the internal instruction ram area by executing a branch instruction. cautions 1. after the reset signal has been cleared, the nmi input is masked by hardware. the nmi is unmasked as soon as the iramm0 bit of the iramm register is cleared in step <3> of the initialization sequence. 2. if it is necessary to confirm nmi input immediately after the reset signal has been cleared and before the internal instruction ram is set in the read mode, read the nmirs bit of the nmi reset status register (nrs). if this bit is set to 1, it indicates that the nmi valid edge has been input. execute the nmi servicing routine as necessary. the nrs register is used only to check nmi input after the reset signal has been cleared and before the internal instruction ram is set in the read mode. this register is not cleared after the reset signal has been cleared. 3. the software exception and exception trap cannot be masked. do not execute the trap and dbtrap instructions until the program code has been transferred to the internal instruction ram. remarks 1. the nmirs bit of the nrs register is also set to 1 if an nmi is input after the internal instruction ram has been set in the read mode. in this case, execution automatically branches to the nmi servicing routine and it is not necessary to confirm the status of the nmirs bit. 2. the nmi input mask function is valid after the reset signal has been cleared and before the internal instruction ram is set in the read mode. 3. to write data to instruction ram bank 0 of the internal instruction ram in the middle of program execution, set the np bit of the psw to 1 to disable nmi and maskable interrupts, so that the software exception and exception trap do not occur. clear the np bit after the program has been rewritten, and after it has been confirmed that the iramm0 bit of the iramm register has been set to 1 and the read mode has been set. 4. nmi and maskable interrupt requests that are generated while the np bit of the psw is set to 1 are held pending. an nmi request is acknowledged immediately after the np bit has been cleared to 0. a maskable interrupt is acknowledged immediately after the np bit has been cleared to 0 if interrupts are not disabled (di status) and the interrupt request is not cleared (by clearing the xxifn bit of the interrupt control register (xxicn) to 0) before the np bit is cleared to 0, and if the xxmkn bit of the interrupt control register is not set to 1. however, only one of the nmi and maskable interrupt requests is held pending for each interrupt source, and only one interrupt request is acknowledged even if the same interrupt request is generated two times or more.
114 preliminar y user?s manual u16031ej2v1ud chapter 4 bus control function the v850e/me2 is provided with an external bus interface function by which external i/o and memories, such as rom and ram, can be connected. 4.1 features  32-bit/16-bit/8-bit data bus sizing function  8-space chip select function  wait function  programmable wait function, through which up to 7 wait states can be inserted for each memory block  external wait function via wait pin  idle state insertion function  bus mastership arbitration function  bus hold function  external device connection enabled via bus control/port alternate function pins 4.2 bus control pins the following pins are used for connection to external devices. bus control pin (function when in control mode) function when in port mode register for port/control mode switching data bus (d0 to d15) ?? data bus (d16 to d31) pdh0 to pdh15 (port dh) pmcdh address bus (a0, a1) pal0, pal1 (port al) pmcal address bus (a16 to a25) pah0 to pah9 (port ah) pmcah chip select (cs0 to cs7, iowr, iord) pcs0 to pcs7 (port cs) pmccs sdram sync control (sdcke) pcd0 (port cd) bus clock (busclk) pcd1 (port cd) sdram control (sdcas, sdras) pcd2, pcd3 (port cd) pmccd read/write control (llwr/llbe/lldqm, luwr/lube/ludqm, ulwr/ulbe/uldqm, uudqm/uube/uuwr, rd, we/wr) pct0 to pct5 (port ct) bus cycle start (bcyst) pct7 (port ct) pmcct external wait control (wait) pcm0 (port cm) bus hold control (hldrq, hldak) pcm2, pcm3 (port cm) sdram refresh control (refrq) pcm4 (port cm) self-refresh control (selfref) pcm5 (port cm) pmccm remark when the system is reset, each bus control pin becomes unconditionally valid. (however, d16 to d31, ulwr/ulbe/uldqm, and uuwr/uube/uudqm are valid only in 32-bit mode.)
chapter 4 bus control function 115 preliminar y user?s manual u16031ej2v1ud 4.2.1 pin status during internal instruction ram, internal data ram, and peripheral i/o access while accessing internal instruction ram (in the read mode), internal data ram, and peripheral i/o, the address bus outputs low level, and the data bus outputs nothing and enters the high-impedance state. the external bus control signals become inactive. when the internal instruction ram is accessed (in the write mode), the address bus and data bus output data. the external bus control signals other than uuwr, ulwr, luwr, llwr, and wr become active. if output of the iowr signal is enabled by setting the ioen bit of the bus cycle period control register (bcp) to 1, the iowr signal becomes active.
chapter 4 bus control function 116 preliminar y user?s manual u16031ej2v1ud 4.3 memory block function the 256 mb memory space is divided into four areas including seven 2 mb memory blocks and one 1 mb memory block. the area that can be used as program area is the 64 mb space of addresses 0000000h to 3ffffffh. block 7 (2 mb) block 6 (2 mb) block 5 (2 mb) block 4 (2 mb) block 3 (2 mb) block 2 (2 mb) block 1 (2 mb) block 0 (1 mb) on-chip peripheral i/o mirror note 1 (4 kb) access-prohibited area note 2 internal data ram mirror (16 kb) internal instruction ram area (1 mb) internal data ram area (16 kb) on-chip peripheral i/o area (4 kb) access-prohibited area note 2 fffffffh fe00000h fdfffffh fc00000h fbfffffh fa00000h f9fffffh f800000h f7fffffh c000000h bffffffh 8000000h 7ffffffh 4000000h 3ffffffh 3fff000h 3ffefffh 3ffb000h 3ffafffh 3ff8000h 3ff7fffh 0800000h 07fffffh 0600000h 05fffffh 0400000h 03fffffh 0200000h 01fffffh 0100000h 00fffffh 0000000h fffffffh ffff000h fffefffh fffb000h fffafffh fff8000h external memory area area 3 cs7, cs6, cs5 cs6 cs4 cs3 cs1 cs2, cs1, cs0 area 2 area 1 area 0 notes 1. addresses 3fff000h to 3ffffffh are access-prohibited. to access the on-chip peripheral i/o, specify addresses ffff000h to fffffffh. 2. the operation is not guaranteed if an access-prohibited area is accessed.
chapter 4 bus control function 117 preliminar y user ? s manual u16031ej2v1ud 4.3.1 chip select control function each memory block can be divided by chip area select control registers 0 and 1 (csc0, csc1) to control the chip select signal. the memory area can be effectively used by dividing it into memory blocks using the chip select control function. the priority order is described below. (1) chip area select control registers 0, 1 (csc0, csc1) these registers can be read or written in 16-bit units and become valid by setting each bit to 1. if different chip select signal outputs are set to the same block, the priority order is controlled as follows. csc0: cs0 > cs2 > cs1 csc1: cs7 > cs5 > cs6 if both the cs0n and cs2n bits of the csc0 register are set to 0, cs1 is output to the corresponding block (n = 0 to 3). similarly, if both the cs5n and cs7n bits of the csc1 register are set to 0, cs6 is output to the corresponding block (n = 0 to 3). caution write to the csc0 and csc1 registers after reset, and then do not change the set value.
chapter 4 bus control function 118 preliminar y user ? s manual u16031ej2v1ud 15 cs33 csc0 address fffff060h after reset 2c11h 14 cs32 13 cs31 12 cs30 11 cs23 10 cs22 9 cs21 8 cs20 7 cs13 6 cs12 5 cs11 4 cs10 3 cs03 2 cs02 1 cs01 0 cs00 15 cs43 csc1 address fffff062h after reset 2c11h 14 cs42 13 cs41 12 cs40 11 cs53 10 cs52 9 cs51 8 cs50 7 cs63 6 cs62 5 cs61 4 cs60 3 cs73 2 cs72 1 cs71 0 cs70 bit position bit name function chip select is enabled by setting the csnm bit to 1. csnm cs operation cs00 cs0 output during block 0 access cs01 cs0 output during block 1 access. cs02 cs0 output during block 2 access. cs03 cs0 output during block 3 access. cs10 to cs13 setting has no meaning. cs20 cs2 output during block 0 access. cs21 cs2 output during block 1 access. cs22 cs2 output during block 2 access. cs23 cs2 output during block 3 access. cs30 to cs33 setting has no meaning. cs40 to cs43 setting has no meaning. cs50 cs5 output during block 7 access. cs51 cs5 output during block 6 access. cs52 cs5 output during block 5 access. cs53 cs5 output during block 4 access. cs60 to cs63 setting has no meaning. cs70 cs7 output during block 7 access. cs71 cs7 output during block 6 access. cs72 cs7 output during block 5 access. cs73 cs7 output during block 4 access. 15 to 0 csnm (n = 0 to 7) (m = 0 to 3) the following diagram shows the cs signal that is enabled for area 0 when the csc0 register is set to 0f03h. when the csc0 register is set to 0f03h, cs0 and cs2 are output to block 0 and block 1, but since cs0 has priority over cs2, cs0 is output if the addresses of block 0 and block 1 are accessed. if the addresses of block 2 and block 3 are accessed, cs2 is output. if the addresses of area 0 other than blocks 0 to 3 are accessed, cs1 is output. the following shows an example when the csc0 register is set to 0803h and the csc1 register is set to 0601h.
chapter 4 bus control function 119 preliminar y user ? s manual u16031ej2v1ud figure 4-1. example when csc0 register is set to 0803h and csc1 register is set to 0601h block 7 (2 mb) block 6 (2 mb) block 5 (2 mb) block 4 (2 mb) block 3 (2 mb) block 2 (2 mb) block 1 (2 mb) block 0 (1 mb) fixed area (1 mb) fffffffh fe00000h fdfffffh fc00000h fbfffffh fa00000h f9fffffh f800000h f7fffffh c000000h bffffffh 8000000h 7ffffffh 4000000h 3ffffffh 0800000h 07fffffh 0600000h 05fffffh 0400000h 03fffffh 0200000h 01fffffh 0100000h 00fffffh 0000000h area 3 area 2 area 1 area 0 2 mb 4 mb 58 mb 64 mb 64 mb 56 mb 2 mb 2 mb 3 mb ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cs7 is output. cs5 is output. cs6 is output. cs4 is output. cs3 is output. cs1 is output. cs2 is output. cs1 is output. cs0 is output. internal instruction ram area
chapter 4 bus control function 120 preliminar y user ? s manual u16031ej2v1ud 4.4 bus cycle type control function in the v850e/me2, the following external devices can be connected directly to each memory block. ? sram, external rom, external i/o ? page rom ? sdram connected external devices are specified by bus cycle type configuration registers 0 and 1 (bct0 and bct1).
chapter 4 bus control function 121 preliminar y user?s manual u16031ej2v1ud 4.4.1 bus cycle type configuration registers 0, 1 (bct0, bct1) (1) bus cycle type configuration registers 0, 1 (bct0, bct1) these registers can be read or written in 16-bit units. be sure to clear bits 14, 10, 6, and 2 to 0. if they are set to 1, the operation is not guaranteed. caution write to the bct0 and bct1 registers after reset, and then do not change the set value. also, do not access an external memory area other than the one for this initialization routine until the initial setting of the bct0 and bct1 registers is complete. however, it is possible to access external memory areas whose initialization settings are complete. cs1 cs2 cs0 cs6 cs5 cs4 bct0 csn signal bct1 csn signal 15 me3 14 0 13 bt31 12 bt30 11 me2 10 0 9 bt21 8 bt20 7 me1 6 0 5 bt11 4 bt10 3 me0 2 0 1 bt01 0 bt00 15 me7 14 0 13 bt71 12 bt70 11 me6 10 0 9 bt61 8 bt60 7 me5 6 0 5 bt51 4 bt50 3 me4 2 0 1 bt41 0 bt40 address fffff480h address fffff482h after reset 8888h after reset 8888h cs3 cs7 bit position bit name function 15, 11, 7, 3 men sets memory controller operation enable for each chip select. 0: operation disabled 1: operation enabled specifies the device to be connected to the csn signal. btn1 btn0 external device connected to csn signal 00 sram, external i/o 01 page rom 10 setting prohibited 11 n = 1, 3, 4, 6: sdram n = 0, 2, 5, 7: setting prohibited 13, 12, 9, 8, 5, 4, 1, 0 btn1, btn0 remark n = 0 to 7
chapter 4 bus control function 122 preliminar y user ? s manual u16031ej2v1ud 4.5 bus access 4.5.1 number of access clocks the number of base clocks necessary for accessing each resource is as follows. operand data access bus cycle configuration resource (bus width) instruction fetch read write internal instruction ram (32 bits) 1 1 2 note internal data ram (32 bits) ? 1 note when the internal instruction ram is accessed (in the write mode), programmable waits, address setup waits, and idle states can be inserted in the cs0 space. if none of the above states is set, the instruction ram is accessed using a 2 busclk frequency clock. remark unit: clock/access
chapter 4 bus control function 123 preliminar y user ? s manual u16031ej2v1ud 4.5.2 bus sizing function the bus sizing function controls the data bus width for each cs space. the data bus width is specified by using the local bus sizing control register (lbs). (1) local bus sizing control register (lbs) this register can be read or written in 16-bit units. cautions 1. write to the lbs register after reset, and then do not change the set value. also, do not access an external memory area other than the one for this initialization routine until the initial setting of the lbs register is complete. however, it is possible to access external memory areas whose initialization settings are complete. 2. when the data bus width is specified as 8 bits, only the signal shown below becomes active. llwr: when accessing sram, external rom, or external i/o (write cycle) 3. when the data bus width is specified as 16 bits, only the signals shown below become active. llwr, luwr: when accessing sram, external rom, or external i/o (write cycle) cs4 cs0 lbs csn signal 15 lb71 14 lb70 13 lb61 12 lb60 11 lb51 10 lb50 9 lb41 8 lb40 7 lb31 6 lb30 5 lb21 4 lb20 3 lb11 2 lb10 1 lb01 0 lb00 address fffff48eh after reset note 5555h/ aaaah cs5 cs3 cs2 cs1 cs6 cs7 note when in 32-bit mode: aaaah when in 16-bit mode: 5555h for details of 32-bit mode and 16-bit mode, refer to 3.3.1 operating modes. bit position bit name function sets the data bus width of the csn space. lbn1 lbn0 data bus width of csn space 0 0 8 bits 0 1 16 bits 10 11 32 bits 15 to 0 lbn1, lbn0 remark n = 0 to 7
chapter 4 bus control function 124 preliminar y user?s manual u16031ej2v1ud 4.5.3 endian control function the endian control function can be used to set processing of word data in memory using either the big endian method or the little endian method for each cs space selected with the chip select signals (cs0 to cs7). switching of the endian method is specified using the endian configuration register (bec). caution in the following areas, the data processing method is fixed to little endian, so the setting of the bec register is invalid. ? ? ? ? on-chip peripheral i/o area ? ? ? ? internal instruction ram area ? ? ? ? internal data ram area ? ? ? ? area same as internal data ram area of addresses 3ff8000h to 3ffbfffh ? ? ? ? program area for external memory (1) endian configuration register (bec) this register can be read or written in 16-bit units. be sure to clear bits 15, 13, 11, 9, 7, 5, 3, and 1 to 0. if they are set to 1, the operation is not guaranteed. caution write to the bec register after reset, and then do not change the set value. 15 0 bec csn signal address fffff068h after reset 0000h 14 be70 13 0 12 be60 11 0 10 be50 9 0 8 be40 7 0 6 be30 5 0 4 be20 3 0 2 be10 1 0 0 be00 cs3 cs2 cs1 cs0 cs4 cs5 cs6 cs7 bit position bit name function 14, 12, 10, 8, 6, 4, 2, 0 ben0 specifies the endian method. 0: little endian method 1: big endian method remark n = 0 to 7
chapter 4 bus control function 125 preliminar y user ? s manual u16031ej2v1ud figure 4-2. big endian addresses within word 0008h 0009h 000ah 000bh 0004h 0005h 0006h 0007h 0000h 0001h 0002h 0003h 31 24 23 16 15 8 7 0 figure 4-3. little endian addresses within word 000bh 000ah 0009h 0008h 0007h 0006h 0005h 0004h 0003h 0002h 0001h 0000h 31 24 23 16 15 8 7 0 4.5.4 big endian method usage restrictions in nec electronics development tools (1) when using a debugger (id850) the big endian method is supported only in the memory window display. (2) when using a compiler (ca850) (a) restrictions in c language (i) there are restrictions for variables allocated to/located in the big endian space, as shown below. ? union cannot be used. ? bitfield cannot be used. ? access with cast (changing access size) cannot be used. ? variables with initial values cannot be used. (ii) it is necessary to specify the following optimization inhibit options because optimization may cause a change in the access size. ? for global optimization part (opt850) ? -wo, -xtb ? for optimization depending on model part (impr850) ? -wi, +arg_reg_opt=off, +stld_trans_opt=off the specification of the optimization inhibit options shown above is not necessary, however, if the access is not an access with cast or with masking/shifting note . note this is on the condition that a pattern that may cause the following optimization is not used. however, because it is very difficult for users to check the patterns completely in cases such as when several patterns are mixed (especially for optimization depending on model part), it is recommended that the optimization inhibit options shown above be specified.
chapter 4 bus control function 126 preliminar y user ? s manual u16031ej2v1ud [related global optimization part] ? 1-bit set using bit or int i; i ^=1; ? 1-bit clear using bit and i &= ~1; ? 1-bit not using bit xor i ^= 1; ? 1-bit test using bit and if(i & 1); [related optimization depending on model part] accessing the same variable in a different size ? cast ? mask ? shift example int i, *ip; char c; . . . c=*((char*)ip); . . . c = 0xff & i; . . . i = (i<<24) >>24; (b) restrictions in assembly language for variables located in the big endian space, a quasi directive that secures an area of other than byte size (.hword, .word, .float, .shword) cannot be used.
chapter 4 bus control function 127 preliminar y user ? s manual u16031ej2v1ud 4.5.5 bus width the v850e/me2 accesses peripheral i/o and external memory in 8-bit, 16-bit, or 32-bit units. the following shows the operation for each type of access. all data is accessed in order starting from the lower order side. (1) byte access (8 bits) (a) when the data bus width is 32 bits (little endian) <1> access to address (4n) <2> access to address (4n + 1) <3> access to address (4n + 2) <4> access to address (4n + 3) 7 0 7 0 15 8 23 16 31 24 byte data external data bus address 4n 7 0 7 0 15 8 23 16 31 24 byte data external data bus address 4n + 1 7 0 7 0 15 8 23 16 31 24 byte data external data bus address 4n + 2 7 0 7 0 15 8 23 16 31 24 byte data external data bus address 4n + 3 (b) when the data bus width is 16 bits (little endian) <1> access to address (4n) <2> access to address (4n + 1) <3> access to address (4n + 2) <4> access to address (4n + 3) 7 0 7 0 byte data 15 8 external data bus 4n address 7 0 7 0 15 8 4n + 1 address byte data external data bus 7 0 7 0 byte data 15 8 external data bus 4n + 2 address 7 0 7 0 15 8 4n + 3 address byte data external data bus
chapter 4 bus control function 128 preliminar y user ? s manual u16031ej2v1ud (c) when the data bus width is 8 bits (little endian) <1> access to address (4n) <2> access to address (4n + 1) <3> access to address (4n + 2) <4> access to address (4n + 3) 7 0 7 0 4n address byte data external data bus 7 0 7 0 4n + 1 address byte data external data bus 7 0 7 0 4n + 2 address byte data external data bus 7 0 7 0 4n + 3 address byte data external data bus (d) when the data bus width is 32 bits (big endian) <1> access to address (4n) <2> access to address (4n + 1) <3> access to address (4n + 2) <4> access to address (4n + 3) 7 0 7 0 15 8 23 16 31 24 byte data external data bus address 4n 7 0 7 0 15 8 23 16 31 24 byte data external data bus address 4n + 1 7 0 7 0 15 8 23 16 31 24 byte data external data bus address 4n + 2 7 0 7 0 15 8 23 16 31 24 byte data external data bus address 4n + 3 (e) when the data bus width is 16 bits (big endian) <1> access to address (4n) <2> access to address (4n + 1) <3> access to address (4n + 2) <4> access to address (4n + 3) 7 0 7 0 15 8 4n address byte data external data bus 7 0 7 0 byte data 15 8 external data bus 4n + 1 address 7 0 7 0 15 8 4n + 2 address byte data external data bus 7 0 7 0 byte data 15 8 external data bus 4n + 3 address
chapter 4 bus control function 129 preliminar y user ? s manual u16031ej2v1ud (f) when the data bus width is 8 bits (big endian) <1> access to address (4n) <2> access to address (4n + 1) <3> access to address (4n + 2) <4> access to address (4n + 3) 7 0 7 0 4n address byte data external data bus 7 0 7 0 4n + 1 address byte data external data bus 7 0 7 0 4n + 2 address byte data external data bus 7 0 7 0 4n + 3 address byte data external data bus
chapter 4 bus control function 130 preliminar y user ? s manual u16031ej2v1ud (2) halfword access (16 bits) (a) when the data bus width is 32 bits (little endian) <1> access to address (4n) <2> access to address (4n + 1) 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n 4n + 1 halfword data 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 1 4n + 2 halfword data <3> access to address (4n + 2) <4> access to address (4n + 3) 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 2 4n + 3 halfword data 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 4 halfword data halfword data
chapter 4 bus control function 131 preliminar y user ? s manual u16031ej2v1ud (b) when the data bus width is 16 bits (little endian) <1> access to address (4n) <2> access to address (4n + 1) 1st access 2nd access 7 0 7 0 15 8 15 8 external data bus 4n 4n + 1 address halfword data 7 0 7 0 15 8 15 8 external data bus 4n + 1 address 7 0 7 0 15 8 15 8 external data bus 4n + 2 address halfword data halfword data <3> access to address (4n + 2) <4> access to address (4n + 3) 1st access 2nd access 7 0 7 0 15 8 15 8 external data bus 4n + 2 4n + 3 address halfword data 7 0 7 0 15 8 15 8 external data bus 4n + 3 address 7 0 7 0 15 8 15 8 external data bus 4n + 4 address halfword data halfword data
chapter 4 bus control function 132 preliminar y user ? s manual u16031ej2v1ud (c) when the data bus width is 8 bits (little endian) <1> access to address (4n) <2> access to address (4n + 1) 1st access 2nd access 1st access 2nd access 7 0 7 0 halfword data halfword data 15 8 external data bus 4n address address 7 0 7 0 15 8 external data bus 4n + 1 7 0 7 0 15 8 external data bus 4n + 1 address address 7 0 7 0 15 8 external data bus 4n + 2 halfword data halfword data <3> access to address (4n + 2) <4> access to address (4n + 3) 1st access 2nd access 1st access 2nd access 7 0 7 0 15 8 external data bus 4n + 2 address address 7 0 7 0 15 8 external data bus 4n + 3 halfword data halfword data 7 0 7 0 15 8 external data bus 4n + 3 address address 7 0 7 0 15 8 external data bus 4n + 4 halfword data halfword data
chapter 4 bus control function 133 preliminar y user ? s manual u16031ej2v1ud (d) when the data bus width is 32 bits (big endian) <1> access to address (4n) <2> access to address (4n + 1) 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 1 4n halfword data 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 2 4n + 1 halfword data <3> access to address (4n + 2) <4> access to address (4n + 3) 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 3 4n + 2 halfword data 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 external data bus address 4n + 4 halfword data halfword data
chapter 4 bus control function 134 preliminar y user ? s manual u16031ej2v1ud (e) when the data bus width is 16 bits (big endian) <1> access to address (4n) <2> access to address (4n + 1) 1st access 2nd access 7 0 7 0 15 8 15 8 external data bus 4n + 1 4n address halfword data 7 0 7 0 15 8 15 8 external data bus 4n + 1 address 7 0 7 0 15 8 15 8 external data bus 4n + 2 address halfword data halfword data <3> access to address (4n + 2) <4> access to address (4n + 3) 1st access 2nd access 7 0 7 0 15 8 15 8 external data bus 4n + 3 4n + 2 address halfword data 7 0 7 0 15 8 15 8 external data bus 4n + 3 address 7 0 7 0 15 8 15 8 external data bus 4n + 4 address halfword data halfword data
chapter 4 bus control function 135 preliminar y user ? s manual u16031ej2v1ud (f) when the data bus width is 8 bits (big endian) <1> access to address (4n) <2> access to address (4n + 1) 1st access 2nd access 1st access 2nd access 7 0 7 0 15 8 external data bus 4n address address 7 0 7 0 15 8 external data bus 4n + 1 halfword data halfword data 7 0 7 0 15 8 external data bus 4n + 1 address address 7 0 7 0 15 8 external data bus 4n + 2 halfword data halfword data <3> access to address (4n + 2) <4> access to address (4n + 3) 1st access 2nd access 1st access 2nd access 7 0 7 0 15 8 external data bus 4n + 2 address address 7 0 7 0 15 8 external data bus 4n + 3 halfword data halfword data 7 0 7 0 15 8 external data bus 4n + 3 address address 7 0 7 0 15 8 external data bus 4n + 4 halfword data halfword data
chapter 4 bus control function 136 preliminar y user ? s manual u16031ej2v1ud (3) word access (32 bits) (a) when the data bus width is 32 bits (little endian) <1> access to address (4n) <2> access to address (4n + 1) 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus address 4n 4n + 1 4n + 2 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus address address 4n + 1 4n + 2 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus 4n + 4 <3> access to address (4n + 2) <4> access to address (4n + 3) 1st access 2nd access 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus address address 4n + 2 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus 4n + 4 4n + 5 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus address address 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus 4n + 5 4n + 4 4n + 6
chapter 4 bus control function 137 preliminar y user ? s manual u16031ej2v1ud (b) when the data bus width is 16 bits (little endian) (1/2) <1> access to address (4n) 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n 4n + 1 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 3 4n + 2 <2> access to address (4n + 1) 1st access 2nd access 3rd access 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 1 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 3 4n + 2 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 4
chapter 4 bus control function 138 preliminar y user ? s manual u16031ej2v1ud (b) when the data bus width is 16 bits (little endian) (2/2) <3> access to address (4n + 2) 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 2 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 5 4n + 4 <4> access to address (4n + 3) 1st access 2nd access 3rd access 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 5 4n + 4 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 6
chapter 4 bus control function 139 preliminar y user ? s manual u16031ej2v1ud (c) when the data bus width is 8 bits (little endian) (1/2) <1> access to address (4n) 1st access 2nd access 3rd access 4th access 7 0 7 0 word data external data bus address 15 8 4n 23 16 31 24 7 0 7 0 word data external data bus 4n + 1 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 2 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 3 address 15 8 23 16 31 24 <2> access to address (4n + 1) 1st access 2nd access 3rd access 4th access 7 0 7 0 word data external data bus address 15 8 4n + 1 23 16 31 24 7 0 7 0 word data external data bus 4n + 2 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 3 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 4 address 15 8 23 16 31 24
chapter 4 bus control function 140 preliminar y user ? s manual u16031ej2v1ud (c) when the data bus width is 8 bits (little endian) (2/2) <3> access to address (4n + 2) 1st access 2nd access 3rd access 4th access 7 0 7 0 word data external data bus address 15 8 4n + 2 23 16 31 24 7 0 7 0 word data external data bus 4n + 3 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 4 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 5 address 15 8 23 16 31 24 <4> access to address (4n + 3) 1st access 2nd access 3rd access 4th access 7 0 7 0 word data external data bus address 15 8 4n + 3 23 16 31 24 7 0 7 0 word data external data bus 4n + 4 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 5 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 6 address 15 8 23 16 31 24
chapter 4 bus control function 141 preliminar y user ? s manual u16031ej2v1ud (d) when the data bus width is 32 bits (big endian) <1> access to address (4n) <2> access to address (4n + 1) 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus address 4n + 3 4n + 2 4n + 1 4n 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus address address 4n + 1 4n + 2 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus 4n + 4 <3> access to address (4n + 2) <4> access to address (4n + 3) 1st access 2nd access 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus address 4n + 5 4n + 4 address 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus 4n + 3 4n + 2 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus address address 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 23 16 31 24 word data external data bus 4n + 5 4n + 6 4n + 4
chapter 4 bus control function 142 preliminar y user ? s manual u16031ej2v1ud (e) when the data bus width is 16 bits (big endian) (1/2) <1> access to address (4n) 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n 4n + 1 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 3 4n + 2 <2> access to address (4n + 1) 1st access 2nd access 3rd access 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 1 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 2 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 4
chapter 4 bus control function 143 preliminar y user ? s manual u16031ej2v1ud (e) when the data bus width is 16 bits (big endian) (2/2) <3> access to address (4n + 2) 1st access 2nd access 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 2 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 5 4n + 4 <4> access to address (4n + 3) 1st access 2nd access 3rd access 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 3 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 4 4n + 5 7 0 7 0 15 8 15 8 23 16 31 24 word data external data bus address 4n + 6
chapter 4 bus control function 144 preliminar y user ? s manual u16031ej2v1ud (f) when the data bus width is 8 bits (big endian) (1/2) <1> access to address (4n) 1st access 2nd access 3rd access 4th access 7 0 7 0 word data external data bus address 15 8 4n + 3 23 16 31 24 7 0 7 0 word data external data bus 4n + 2 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 1 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n address 15 8 23 16 31 24 <2> access to address (4n + 1) 1st access 2nd access 3rd access 4th access 7 0 7 0 word data external data bus address 15 8 4n + 4 23 16 31 24 7 0 7 0 word data external data bus 4n + 3 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 2 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 1 address 15 8 23 16 31 24
chapter 4 bus control function 145 preliminar y user ? s manual u16031ej2v1ud (f) when the data bus width is 8 bits (big endian) (2/2) <3> access to address (4n + 2) 1st access 2nd access 3rd access 4th access 7 0 7 0 word data external data bus address 15 8 4n + 5 23 16 31 24 7 0 7 0 word data external data bus 4n + 4 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 3 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 2 address 15 8 23 16 31 24 <4> access to address (4n + 3) 1st access 2nd access 3rd access 4th access 7 0 7 0 word data external data bus address 15 8 4n + 6 23 16 31 24 7 0 7 0 word data external data bus 4n + 5 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 4 address 15 8 23 16 31 24 7 0 7 0 word data external data bus 4n + 3 address 15 8 23 16 31 24
chapter 4 bus control function 146 preliminar y user?s manual u16031ej2v1ud 4.5.6 data read control function (1) line buffer control registers 0, 1 (lbc0, lbc1) the v850e/me2 has a read buffer. the lbc0 and lbc1 registers set the operating conditions of the read buffer in each cs space. these registers can be read or written in 16-bit units. be sure to clear bits 15, 14, 11, 10, 7, 6, 3, and 2 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. be sure to write data to the lbc0 and lbc1 registers after reset. after writing data to these registers, do not change their values. 2. when the speculative read function is set for each csn space, do not insert an idle state in the csn space for which the speculative read function is enabled by the bcc register (n = 0 to 7). if an idle state is required to be inserted in the csn space for which the speculative read function is enabled, enable the speculative read function for all csn spaces (set the lbc0 and lbc1 registers to 3333h) or disable the speculative read function for all csn spaces (set the lbc0 and lbc1 registers to 0000h). cs1 cs2 cs0 cs6 cs5 cs4 lbc0 csn signal lbc1 csn signal 15 0 14 0 13 rb31 12 rb30 11 0 10 0 9 rb21 8 rb20 7 0 6 0 5 rb11 4 rb10 3 0 2 0 1 rb01 0 rb00 15 0 14 0 13 rb71 12 rb70 11 0 10 0 9 rb61 8 rb60 7 0 6 0 5 rb51 4 rb50 3 0 2 0 1 rb41 0 rb40 address fffff490h address fffff492h after reset 0000h after reset 0000h cs3 cs7 bit position bit name function these bits set the operating conditions of the read buffer (timing of speculative read) in each csn space. rbn1 rbn0 timing of speculative read 00 01 without speculative read (operation of read buffer is prohibited) 1 0 setting prohibited 1 1 in all cycles (including data access) 13, 12, 9, 8, 5, 4, 1, 0 rbn1, rbn0 remarks 1. n = 0 to 7 2. if the setting of the rbn1 and rbn0 bits is changed, the data in the read buffer is immediately invalidated.
chapter 4 bus control function 147 preliminar y user ? s manual u16031ej2v1ud (a) speculative read function (read buffer function) the v850e/me2 has speculative read buffers consisting of 4 words (128 bits). if the operating conditions set by the lbc0 or lbc1 register are satisfied when a read request is issued from the cpu or dma controller to a csn space, the requested address is read and the remaining three words of data are read (speculatively) to the read buffers, regardless of whether a request is issued from the cpu or dma controller. data is read to the read buffers in the sequence of critical first access. example of transfer: for speculative reading of 32 bits (i) xxxxx00h xxxxx04h xxxxx08h xxxxx0ch (ii) xxxxx04h xxxxx08h xxxxx0ch xxxxx00h (iii) xxxxx01h xxxxx05h xxxxx09h xxxxx0dh note note if the lower 2 bits of an address are not used in the 32-bit mode, the operation is the same as (i) above. the four words of data that have been read are held in the read buffers. if the following conditions are satisfied, the data in the buffers is lost. ? speculative read miss hit (read request to external memory area not stored in read buffer) ? writing bct0 or bct1 register ? writing lbs register ? writing lbc0 or lbc1 register ? generation of bus hold ? generation of dma flyby cycle (not dependent on cs space) ? memory write access to speculatively read line address if the cpu or dma controller requests reading the data held in the read buffers, the data is transferred to the cpu or dma controller without generating an external memory cycle. remark if the speculative read function is enabled in the 32-bit mode (with a 32-bit data bus width) and the ld.w instruction is executed at address xxxxx0dh, the following bus cycles are successively generated. xxxxx0ch xxxxx00h xxxxx04h xxxxx08h penalty cycle due to speculative reading xxxxx10h xxxxx14h xxxxx18h xxxxx1ch penalty cycle due to speculative reading the cpu reads the following data when it stores data in the read buffer. xxxxx0dh (8 bits) xxxxx0eh (16 bits) xxxxx10h (8 bits)
chapter 4 bus control function 148 preliminar y user ? s manual u16031ej2v1ud the speculative read operation is outlined below. figure 4-4. outline of speculative read operation read buffer 1 (32 bits) read buffer 2 (32 bits) read buffer 3 (32 bits) read buffer 4 (32 bits) cpu or dma controller <1> <3> <4> <5> <6> <2> external interface (a) a read cycle to the address requested by the cpu or dma controller is executed (<1>). (b) the cpu or dma controller reads the data loaded to read buffer 1 (<2>). (c) read buffers 2 to 4 are speculatively read, and a read cycle of the remaining three words is executed (<3> to <5>). (d) if the cpu or dma controller generates a read request to an address that has already been speculatively read, data is read from read buffers 2 to 4 (a read access to the external memory does not occur) (<6>). remarks 1. (b) and (c) are executed in parallel ((d) is also executed in parallel if data is stored in the read buffers). 2. if the cpu or dma controller issues a read request to an address that is not speculatively read in (c) in the cycle of (d), the operation is kept waiting until the operation of (c) is completed. after completion of the operation of (c), all data in the read buffers is discarded, and an operation in response to the next address request is executed starting from (a) (miss hit operation of the speculative read function). (b) write buffer function the v850e/me2 has an on-chip write buffer of 4 words (128 bits). the write buffer stores data if a write cycle cannot be executed while the external bus is occupied note . the next instructions are speculatively executed until the write buffer becomes full. the write buffer is valid for all the external memory areas. if a write request is generated while the write buffer is full, the next instruction execution is postponed until there is a vacancy in the write buffer. while data is being stored in the write buffer (when a write operation to the external memory has not been completed), dma and bus hold requests are not acknowledged (dma and bus hold requests are acknowledged and an enable signal is generated after all the data of the write buffers has been written to the external memory). note the external bus is occupied when there is a bus cycle currently under execution. if instruction fetch cycles are successively executed, all write cycles for the write data stored in the write buffer are always generated after the bus cycle currently under execution (instruction fetch cycle) is completed.
chapter 4 bus control function 149 preliminar y user?s manual u16031ej2v1ud cautions 1. because the write buffer consists of four stages, the write buffer becomes full after 4 bytes (32 bits) when a byte write operation is executed (while a write operation to the external memory is standing by). similarly, the conditions under which the write buffer becomes full vary due to an address miss-align access, etc. 2. when data is written to an external device, the write operation to the external device may not be executed even when a cpu write operation has been completed by the write buffer. the cpu can access the on-chip peripheral i/o registers after the write operation has been completed, regardless of whether a write operation to the external device is executed. therefore, if it is necessary to change the value of an on-chip peripheral i/o register after completion of execution of an external memory cycle, write the same value as the default value to the lbc0 or lbc1 register, and then write the on-chip peripheral i/o register whose value is to be changed. when writing an on-chip peripheral i/o register other than the lbc0 or lbc1 register without writing the same value as the default value to the lbc0 or lbc1 register, the register value may be changed before completion of the external memory cycle. although rewriting the lbc0 and lbc1 registers is prohibited, the same value can be rewritten to the registers in this case. however, if a value different from the default value is written to the lbc0 or lbc1 register, the operation is not guaranteed. 3. during 2-cycle transfer that writes data to the external device, the write operation to the external device may not be completed even if tcn bit of dchcn register = 1 (dma transfer completion) is read by the write buffer (n = 0 to 3). if it is necessary to change the value of an on-chip peripheral i/o register after completion of dma transfer (completion of a write operation to the external device), perform either of the following operations. ? ? ? ? monitor the tcn signal (the tcn signal becomes active in synchronization with a write operation to the external device). ? ? ? ? after detecting setting (to 1) of the tcn bit, write the same value as the default value to the lbc0 or lbc1 register, and then change the value of the on-chip peripheral i/o register. if the value of an on-chip peripheral i/o register other than the lbc0 and lbc1 registers is changed without writing the same value to lbc0 or lbc1, the value of the on-chip peripheral i/o register may be changed before completion of dma transfer. although rewriting the lbc0 and lbc1 registers is prohibited, the same value can be rewritten to the registers in this case. however, if a value different from the default value is written to the lbc0 or lbc1 register, the operation is not guaranteed.
chapter 4 bus control function 150 preliminar y user ? s manual u16031ej2v1ud 4.6 bus clock control function (1) bus mode control register (bmc) this register sets the division rate of the bus clock (busclk) with respect to the internal system clock. writing the bmc register stops busclk once at low level. busclk resumes operation with the set divided clock after it has been stopped. while busclk is stopped, the operation of the sdram refresh control register (rfsn) of sdram is also stopped (n = 1, 3, 4, 6). this register can be read or written in 8-bit units. be sure to clear bits 7 to 2 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. write the bmc register after reset, and then do not change the value that has been written. 2. before writing to the bmc register, be sure to set the vswc register to x7h (x: value before setting the bmc register). after writing the set value to the bmc register, re-set the value of the vswc register to the value before the set value of the bmc register was written (see 3.4.10 initialization sequence). 0 0 0 0 0 0 ckm1 ckm0 76543210 bmc address fffff498h after reset 00h bit position bit name function these bits set the division ratio of the bus clock (busclk) with respect to the internal system clock (f clk ). ckm1 ckm0 division ratio of busclk vs. f clk 00f clk 01f clk /2 10f clk /3 11f clk /4 1, 0 ckm1, ckm0 remark f clk : internal system clock
chapter 4 bus control function 151 preliminar y user ? s manual u16031ej2v1ud figure 4-5. bmc register switching timing internal system clock (f clk ) rd (output) a0 to a25 (output) wr (output) d0 to d31 (i/o) cs0 to cs7 (output) busclk (output) within internal system clock 12 clocks internal system clock 12 clocks bcyst (output) note 2 (output) bmc register changed t0 note 1 t1 notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remark the broken lines indicate the high-impedance state.
chapter 4 bus control function 152 preliminar y user?s manual u16031ej2v1ud 4.7 wait function 4.7.1 programmable wait function (1) data wait control registers 0, 1 (dwc0, dwc1) to facilitate interfacing with low-speed memory and i/os, it is possible to insert up to 7 data wait states in the starting bus cycle for each cs space. the number of wait states can be specified by program using dwc0 and dwc1 registers. just after system reset, all blocks have 7 data wait states inserted. these registers can be read or written in 16-bit units. cautions 1. the internal instruction ram area (in the read mode) and internal data ram area are not subject to programmable waits and ordinarily no wait access is carried out. when the internal instruction ram area is accessed (in the write mode), the programmable wait value set for the cs0 space becomes valid. the on-chip peripheral i/o area is not subject to programmable waits, with wait control performed by each peripheral function only. 2. in the following cases, the settings of the dwc0 and dwc1 registers are invalid (wait control is performed by each memory controller). ? ? ? ? page rom on-page access ? ? ? ? sdram access 3. write to the dwc0 and dwc1 registers after reset, and then do not change the set values. also, do not access an external memory area other than the one for this initialization routine until the initial setting of the dwc0 and dwc1 registers is complete. however, it is possible to access external memory areas whose initialization settings are complete.
chapter 4 bus control function 153 preliminar y user?s manual u16031ej2v1ud 15 dwc0 csn signal address fffff484h after reset 7777h 14131211109876543210 0 dw32 dw31 dw30 0 dw22 dw21 dw20 0 dw12 dw11 dw10 0 dw02 dw01 dw00 0 dw72 dw71 dw70 0 dw62 dw61 dw60 0 dw52 dw51 dw50 0 dw42 dw41 dw40 cs3 cs2 cs1 cs0 cs7 cs6 cs5 cs4 15 dwc1 csn signal address fffff486h after reset 7777h 14131211109876543210 bit position bit name function specifies the number of wait states inserted in the csn space. dwn2 dwn1 dwn0 number of wait states inserted in csn space 0 0 0 not inserted 0011 0102 0113 1004 1015 1106 1117 14 to 12, 10 to 8, 6 to 4, 2 to 0 dwn2 to dwn0 remark n = 0 to 7
chapter 4 bus control function 154 preliminar y user ? s manual u16031ej2v1ud (2) address setup wait control register (asc) the v850e/me2 allows insertion of address setup wait states before the sram/page rom cycle (the setting of the asc register in the sdram cycle is invalid). the number of address setup wait states can be set with the asc register for each cs space. this register can be read or written in 16-bit units. cautions 1. the internal instruction ram area (in the read mode), internal data ram area, and on- chip peripheral i/o area are not subject to address setup wait insertion. when the internal instruction ram area is accessed (in the write mode), the address setup wait value set for the cs0 space becomes valid. 2. during an address setup wait, the wait pin-based external wait function is disabled. 3. write to the asc register after reset, and then do not change the set value. 15 ac71 asc csn signal address fffff48ah after reset ffffh 14 ac70 13 ac61 12 ac60 11 ac51 10 ac50 9 ac41 8 ac40 7 ac31 6 ac30 5 ac21 4 ac20 3 ac11 2 ac10 1 ac01 0 ac00 cs3 cs2 cs1 cs0 cs4 cs5 cs6 cs7 bit position bit name function specifies the number of address setup wait states inserted before the sram/page rom cycle for each csn space. acn1 acn0 number of wait states 00not inserted 011 102 113 15 to 0 acn1, acn0 remark n = 0 to 7
chapter 4 bus control function 155 preliminar y user?s manual u16031ej2v1ud (3) bus cycle period control register (bcp) with the v850e/me2, the operations of iord and iowr can be enabled or disabled in the sram, external rom, and external i/o cycles. this register can be read or written in 8-bit or 1-bit units. be sure to clear bits 7 to 4 and 2 to 0 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. during a flyby dma transfer for sram, external rom, or external i/o, the iord and iowr signals are always output, irrespective of the ioen bit setting. flyby transfer from external i/o to external memory: iord and wr signals become active. flyby transfer from external memory to external i/o: iowr and rd signals become active. in page rom cycle, on the other hand, the ioen bit setting has no meaning. 2. write to the bcp register after reset, and then do not change the set values. 3. if the internal instruction ram is accessed while the ioen bit is set (1) (write mode), the iowr signal becomes active. 0 0 0 0 ioen 0 0 0 76543210 bcp address fffff48ch after reset 00h bit position bit name function specifies whether to enable/disable the operation of iord and iowr in sram, external rom, and external i/o cycles. ioen enable/disable iord and iowr operation 0 disables the operation of iord and iowr in sram, external rom, and external i/o cycles. 1 enables the operation of iord and iowr in sram, external rom, and external i/o cycles. 3ioen
chapter 4 bus control function 156 preliminar y user ? s manual u16031ej2v1ud (4) dma flyby transfer wait control register (fwc) the fwc register sets the number of data wait cycles during dma flyby transfer for each channel n (see the timing chart in 6.5.2 flyby transfer ) (n = 0 to 3). the set value of this register is valid during dma flyby transfer, and the set values of the dwc0, dwc1, and prc registers are invalid. this register can be read or written in 16-bit units. cautions 1. the internal instruction ram area and internal data ram area are not subject to the programmable wait operation and are always accessed with no wait cycle. the on-chip peripheral i/o area is also not subject to the programmable wait operation, and is subject only to wait control by each peripheral function. 2. write to the fwc register after reset, and then do not change the set values. 3. dma flyby transfer that accesses sdram inserts the set value + 1 data wait cycles. 0 fw32 fw31 fw30 0 fw22 fw21 fw20 0 fw12 fw11 fw10 0 fw02 fw01 fw00 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 fwc address fffff494h after reset 7777h bit position bit name function these bits set the number of data wait cycles to each channel n during dma flyby transfer. number of data wait cycles fwn2 fwn1 fwn0 when sdram is not accessed when sdram is accessed 0 0 0 not inserted 1 0011 2 0102 3 0113 4 1004 5 1015 6 1106 7 1117 8 14 to 12, 10 to 8, 6 to 4, 2 to 0 fwn2 to fwn0 remark n = 0 to 3
chapter 4 bus control function 157 preliminar y user ? s manual u16031ej2v1ud 4.7.2 external wait function when an extremely slow device, i/o, or asynchronous system is connected, an arbitrary number of wait states can be inserted in the bus cycle by the external wait pin (wait) for synchronization with the external device. just as with programmable waits, accessing internal instruction ram (in the read mode), internal data ram, and on-chip peripheral i/o areas cannot be controlled by external waits. the external wait signal can be input asynchronously to busclk and is sampled at the rising edge of the clock in the t1 and tw states of a bus cycle. if the setup/hold time in the sampling timing is not satisfied, the wait state may or may not be inserted in the next state. caution be sure to make the wait pin high when the internal instruction ram is accessed (in the write mode). 4.7.3 relationship between programmable wait and external wait a wait cycle is inserted as the result of an or operation between the wait cycle specified by the set value of the programmable wait and the wait cycle controlled by the wait pin. in other words, the number of wait cycles is determined by the side with the greatest number of cycles. wait control programmable wait wait by wait pin for example, if the timings of the programmable wait and the wait pin signal are as illustrated below, three wait states will be inserted in the bus cycle. figure 4-6. example of wait insertion t1 tw tw tw t2 busclk wait pin wait by wait pin programmable wait wait control remark the circle { indicates the sampling timing.
chapter 4 bus control function 158 preliminar y user ? s manual u16031ej2v1ud 4.7.4 bus cycles in which wait function is valid in the v850e/me2, the number of waits can be specified according to the memory type specified for each memory block. the following shows the bus cycles in which the wait function is valid and the registers used for wait setting. table 4-1. bus cycles in which wait function is valid programmable wait setting bus cycle type of wait register bit wait count wait from wait pin address setup wait asc acn1, acn0 0 to 3 ? (invalid) sram, external rom, external i/o cycles data access wait dwc0, dwc1 dwn2 to dwn0 0 to 7 (valid) address setup wait asc acn1, acn0 0 to 3 ? (invalid) off-page data access wait dwc0, dwc1 dwn2 to dwn0 0 to 7 (valid) page rom cycle on-page data access wait prc prw2 to prw0 0 to 7 (valid) sdram cycle row address precharge scrm bcwm1, bcwm0 1 to 3 ? (invalid) external i/o sram flyby transfer wait fwc fwa2 to fwa0 0 to 7 (valid) row address precharge scrm bcwm1, bcwm0 1 to 3 ? (invalid) off-page flyby transfer wait fwc fwa2 to fwa0 0 to 7 (valid) row address precharge scrm bcwm1, bcwm0 1 to 3 ? (invalid) sdram external i/o on-page flyby transfer wait fwc fwa2 to fwa0 0 to 7 (valid) row address precharge scrm bcwm1, bcwm0 1 to 3 ? (invalid) off-page flyby transfer wait fwc fwa2 to fwa0 0 to 7 (valid) row address precharge scrm bcwm1, bcwm0 1 to 3 ? (invalid) dma flyby transfer cycle external i/o sdram on-page flyby transfer wait fwc fwa2 to fwa0 0 to 7 (valid) remark n = 0 to 7, m = 1, 3, 4, 6, a = 0 to 3
chapter 4 bus control function 159 preliminar y user ? s manual u16031ej2v1ud 4.8 idle state insertion function (1) bus cycle control register (bcc) to facilitate interfacing with low-speed memory devices, an idle state (ti) can be inserted into the current bus cycle after the t2 state to meet the data output float delay time (t df ) on memory read access for each cs space. the bus cycle following the t2 state starts after the idle state is inserted. an idle state is inserted at the timing shown below. ? after read/write cycles for sram, external i/o, or external rom ? after a read cycle for page rom ? after a read cycle for sdram the idle state insertion setting can be specified by program using the bus cycle control register (bcc). immediately after the system reset, idle state insertion is automatically programmed for all memory blocks. for the timing when an idle state is inserted, see the memory access timings in chapter 5. this register can be read or written in 16-bit units. cautions 1. the internal instruction ram area (in the read mode), internal data ram area, and on- chip peripheral i/o area are not subject to idle state insertion. when the internal instruction ram area is accessed (in the write mode), the idle state value set for the cs0 space becomes valid. 2. write to the bcc register after reset, and then do not change the set values. also, do not access an external memory area other than the one for this initialization routine until the initial setting of the bcc register is complete. however, it is possible to access external memory areas whose initialization settings are complete. 3. the chip select signal (csn) does not become active in the idle state (n = 0 to 7). 15 bc71 bcc csn signal address fffff488h after reset ffffh 14 bc70 13 bc61 12 bc60 11 bc51 10 bc50 9 bc41 8 bc40 7 bc31 6 bc30 5 bc21 4 bc20 3 bc11 2 bc10 1 bc01 0 bc00 cs3 cs2 cs1 cs0 cs4 cs5 cs6 cs7 bit position bit name function specifies the insertion of an idle state in the csn space. bcn1 bcn0 idle state in csn space 00not inserted 011 102 113 15 to 0 bcn1, bcn0 remark n = 0 to 7
chapter 4 bus control function 160 preliminar y user ? s manual u16031ej2v1ud (2) dma flyby transfer idle control register (fic) the fic register sets the number of idle states during dma flyby transfer for each dma channel n (see the timing chart in 6.5.2 flyby transfer ) (n = 0 to 3). the idle state is inserted at the end of dma flyby transfer. during dma flyby transfer, the set value of this register is valid, and the set value of the bus cycle control register (bcc) is invalid. this register can be read or written in 16-bit units. cautions 1. the internal instruction ram area, internal data ram area, and on-chip peripheral i/o area are not subject to idle state insertion. 2. write to the fic register after reset, and then do not change the set values. 00 fi31 fi30 00 fi21 fi20 00 fi11 fi10 00 fi01 fi00 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 fic address fffff496h after reset 3333h bit position bit name function these bits specify the number of idle states during dma flyby transfer for each channel n. fin1 fin0 idle state during dma flyby transfer 00not inserted 011 102 113 13, 12, 9, 8, 5, 4, 1, 0 fin1, fin0 remark n = 0 to 3
chapter 4 bus control function 161 preliminar y user?s manual u16031ej2v1ud 4.9 instruction cache function the v850e/me2 has an 8 kb 2-way set associative instruction cache. this instruction cache uses an lru (least recently used) algorithm. this cache uses two ways as the cache, with the way to be replaced in case of a miss hit determined by the internal lru bit. if the way is specified as a cacheable area, a 4-word burst sequential read cycle is issued (when the external 32-bit bus operates) (when the external 16-bit bus operates, an 8-halfword burst read cycle is issued). set the instruction cache using the following procedure, after system reset. <1> wait until the value of the icc register reaches ?0000h? (until the tag is initialized). <2> make the setting of the instruction cache cacheable by using the bhc register. caution be sure to set the bhc register in an uncached area (instructions cannot be fetched correctly if it is set from a cacheable area). 4.9.1 cache configuration register (bhc) (1) cache configuration register (bhc) this register can set the configuration of the cache memory in each cs space selected by the chip select signals (cs0 to cs2). setting a cacheable area becomes valid immediately after the bhc register has been set. this register can be read or written in 16-bit units. be sure to clear bits 15 to 5 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. write the bhc register after reset, and then do not change the set values. 2. the area that includes the instruction that sets the bhc register cannot be set from an uncached area to a cacheable area, or from a cacheable area to an uncached area. in this case, branch to area 1 and then set area 0 to a cacheable area by an instruction in area 1. if necessary, branch to area 0 again. an uncached area and a cacheable area can be set in any cs space in the internal instruction ram area. (example of prohibited setting) ? ? ? ? if the instruction that sets the bhc register is in area 0 area 0 before setting bhc area 1 uncached area uncached area area 0 after setting bhc (area 0 is set as cacheable area in area 0) area 1 cacheable area uncached area
chapter 4 bus control function 162 preliminar y user ? s manual u16031ej2v1ud cautions 3. if adjacent memory areas are a cacheable area and an uncached area, only a branch instruction can be used to successively access this memory boundary. the operation is not guaranteed if this memory boundary is successively accessed by an instruction other than a branch instruction. (operation example) ? ? ? ? an access from area 0 to area 1 can be made only by a branch instruction. ? ? ? ? successive accesses can be made from area 1 to area 2. area 0 area 1 uncached area cacheable area area 2 cacheable area cs0 bhc csn signal 15 0 14 0 13 0 12 0 11 0 10 0 9 0 8 0 7 0 6 0 5 0 4 bh20 3 0 2 bh10 1 0 0 bh00 address fffff06ah after reset 0000h cs2 cs1 bit position bit name function 4, 2, 0 bhn0 these bits set the instruction cache placed in the csn space. 0: uncached 1: cacheable remark n = 0 to 2
chapter 4 bus control function 163 preliminar y user ? s manual u16031ej2v1ud 4.9.2 8 kb 2-way set associative cache the data memory of the 8 kb 2-way set associative cache has two ways each consisting of 4-word lines and blocks of 256 entries, and has a total capacity of 8 kb. if a cache miss occurs, the data memory is refilled in 1-line units. only the instructions related to data access of the cacheable area can be cached in the instruction cache. figure 4-7. configuration of 8 kb 2-way set associative instruction cache 12 25 11 4 3 2 1 0 tag index tag data (4 words) comparator iihit selector instruction data way select control signal when a hit occurs internal bus internal bus 32 32 32 256 entries 2 8 14 1 word 1 word 1 word 1 word . . . . . . . . . . . . 14 14 4.9.3 lru algorithm this algorithm is used to record accesses to blocks and replace the block that has not been used for the longest time, so that information that may be necessary is not discarded immediately.
chapter 4 bus control function 164 preliminar y user ? s manual u16031ej2v1ud 4.9.4 instruction cache control function (1) instruction cache control register (icc) this register sets two types of functions, tag clear and auto fill. this register can be read or written in 16-bit units. if the higher 8 bits of the icc register are used as an icch register, and the lower 8 bits, as an iccl register, these registers can be read or written in 8-bit or 1-bit units. bit 12 can only be read and cleared. be sure to clear bits 15 to 13, 11 to 5, 3, and 2 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. do not forcibly clear bits 0, 1, and 4 when they are set to 1. 2. do not set bit 4 to 1 at the same time as the other bits. 3. do not set bit 12 to 1. this bit can only be cleared to 0. 4. be sure to set the icc register in an uncached area (except setting of bit 4). 000 locki0 0000 0 0 0 fill0 00 tclr1tclr0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 icc address fffff070h after reset 0003h note note the value of this register is 0003h when the reset signal becomes active, and initialization of the tag is automatically started. when initialization of the tag has been completed, the value of this register is cleared to 0000h. bit position bit name function 12 locki0 indicates the cache lock status of way 0. the cache is locked when way 0 is filled, and this bit is automatically set to 1. when this bit is cleared to 0, cache lock of way 0 is cleared. 0: way 0 is not locked. 1: way 0 is locked. 4 fill0 sets auto fill of way 0. when this bit is set to 1, way 0 is automatically filled. when auto fill has been completed, this bit is automatically cleared to 0. 0: filling way 0 is completed. 1: way 0 is being filled. 1 tclr1 sets tag clear of way 1. when this bit is set to 1, the tag of way 1 is cleared (invalidated). when clearing the tag has been completed, this bit is automatically cleared to 0. 0: clearing tag of way 1 is completed. 1: tag of way 1 is being cleared. 0 tclr0 sets tag clear of way 0. when this bit is set to 1, the tag of way 0 is cleared (invalidated). when clearing the tag has been completed, this bit is automatically cleared to 0. 0: clearing tag of way 0 is completed. 1: tag of way 0 is being cleared.
chapter 4 bus control function 165 preliminar y user ? s manual u16031ej2v1ud (2) instruction cache data configuration register (icd) this register sets the address of the memory area that is automatically filled by the auto fill function. this register can be read or written in 16-bit units. be sure to clear bit 0 to 0. if it is set to 1, the operation is not guaranteed. cautions 1. do not rewrite the icd register during the auto fill operation. the operation is not guaranteed if it is rewritten. 2. because the default value of the icd register is undefined, be sure to set a value to the icd register when the auto fill function is used, and then set the fill0 bit of the icc register to 1. if the fill0 bit of the icc register is set to 1 without setting a value to the icd register, the operation is not guaranteed. 15 0 14 icd 14 13 icd 13 12 icd 12 11 icd 11 10 icd 10 9 icd 9 8 icd 8 7 icd 7 6 icd 6 5 icd 5 4 icd 4 3 icd 3 2 icd 2 1 icd 1 0 0 icd address fffff074h after reset undefined bit position bit name function 14 to 1 icd14 to icd1 set the higher 14 bits of tag information (bits 25 to 12 of the first address of the memory area to be automatically filled).
chapter 4 bus control function 166 preliminar y user ? s manual u16031ej2v1ud 4.9.5 tag clear function the tag of one way is cleared (invalidated). after reset, all the ways, tags, and lru are automatically cleared (invalidated). the instruction cache tag is cleared using the following procedure. <1> the icc register is read to confirm that both the tclr0 and tclr1 bits are cleared to 0. <2> the icc register is read to confirm that the locki0 bit is cleared to 0. bit 13 of the icc register is always cleared to 0. <3> the tclr0 and tclr1 bits of the icc register are set as follows. cautions 1. perform operations <1> to <3> above (tag clear) in an uncached area (the tag is not cleared from a cacheable area). ? ? ? ? to clear both ways 0 and 1 at the same time (a) set the tclr0 and tclr1 bits to 1. (b) read the tclr0 and tclr1 bits to confirm that they are cleared to 0. ? ? ? ? to clear ways 0 and 1 separately note (a) set the tclr0 bit to 1. (b) read the tclr0 bit to confirm that it is cleared to 0. (c) set the tclr1 bit to 1. (d) read the tclr1 bit to confirm that it is cleared to 0. note the ways can be cleared separately also in the order of (c) - (d) - (a) - (b). 2. the counter for clearing the tag of ways 0 and 1 is shared. therefore, clear the tag (by setting the tclr0 or tclr1 bit of the icc register) when the counter for clearing the tag is stopped (when tclr0 = tclr1 = 0). when clearing the tags of ways 0 and 1 separately, the counter stops while a tag is being cleared if the tag of one other way is cleared while the tag of the other way is being cleared (tclr0 or tclr1 = 1). consequently, the tag cannot be cleared correctly because the tag of the other way is cleared with the counter indicating a midway value. be sure to clear the tag of one other way after confirming that the tag of the other way has been cleared (tclr0 or tclr1 = 0). there is no problem if both the bits are set at the same time as follows. mov 0x3, r2 lop0: ld.h icc[r0], r1 cmp r0, r1 bnz lop0 st.h r2, icc[r0] lop1: ld.h icc[r0], r1 cmp r0, r1 bnz lop1 3. do not perform other processing in parallel with clearing the tag until it is confirmed by reading the tclr0 and tclr1 bits of the icc register that the tag has been cleared to 0.
chapter 4 bus control function 167 preliminar y user ? s manual u16031ej2v1ud 4.9.6 auto fill function (way 0 only) the instruction of one way is automatically filled. the way that has been filled automatically is automatically locked and prohibited from being written, and performs the same operation as rom that can be accessed in one cycle. after the way is unlocked, it operates as an instruction cache again. the instruction cache is automatically filled using the following procedure. <1> clear (invalidate) the tag of way 0 (see 4.9.5 tag clear function ). <2> set information on the tag corresponding to the memory area to be automatically filled to the icd register. <3> branch to the cacheable area corresponding to the tag information set to the icd register. <4> set the fill0 bit of the icc register to 1. <5> when auto fill is completed, the locki0 bit of the icc register is automatically set to 1, and way 0 is locked. at this time, read the fill0 bit of the icc register at the same time to confirm that this bit is cleared to 0. caution perform the above operations in the following areas. <1>, <2>, <3> ........ uncached area <4> ........................ cacheable area if the fill0 bit of the icc register is set to 1 from an uncached area, auto fill cannot be executed (is invalidated). <5> ........................ this can be done from both an uncached area and a cacheable area. remark to unlock the way, clear the locki0 bit of the icc register to 0.
chapter 4 bus control function 168 preliminar y user ? s manual u16031ej2v1ud 4.10 internal instruction ram control function the v850e/me2 has 128 kb of instruction ram (16 kb 32 bits 2 banks). while one bank is being read, the other bank can be written in parallel. 4.10.1 internal instruction ram mode register (iramm) (1) internal instruction ram mode register (iramm) this register specifies a mode in which the instruction ram is accessed. this register can be read or written in 8-bit or 1-bit units. cautions 1. when the setting of a mode is changed, the next access (such as code fetching) to the internal instruction ram may be executed first because of the pipeline operation of the cpu. when the setting of the iramm register is changed, therefore, be sure to read the iramm register to confirm that writing has been executed, and then execute an access to the internal instruction ram. 2. data can be written to the internal instruction ram only by a word access. 3. address miss-align access to the internal instruction ram is prohibited. 0 0 0 0 0 0 iramm1 iramm0 76543210 iramm address fffff80ah after reset 03h bit position bit name function 1 iramm1 specifies the access mode of instruction ram bank 1. 0: read mode 1: write mode 0 iramm0 specifies the access mode of instruction ram bank 0. 0: read mode 1: write mode figure 4-8. memory map of internal instruction ram 001ffffh 0010000h 000ffffh 0000000h instruction ram bank 1 (64 kb) instruction ram bank 0 (64 kb)
chapter 4 bus control function 169 preliminar y user ? s manual u16031ej2v1ud 4.10.2 operation (1) read operation the internal instruction ram can be read by normal ram access without having to be aware of the banks if the read mode is selected by the iramm register. cautions 1. a bank in the write mode cannot be read. 2. the internal instruction ram (in the read mode) is accessed using the 1 internal system clock. (2) write operation the internal instruction ram can be written by normal ram access without having to be aware of the banks if the write mode is selected by the iramm register. cautions 1. a bank in the read mode cannot be written. 2. internal instruction ram bank 0 area is allocated to interrupt and exception tables. disable interrupts until writing an instruction code to bank 0 of the internal instruction ram is completed. similarly, disable interrupts when bank 0 of the internal instruction ram is set in the write mode. for disabling maskable interrupts, refer to interrupt mask registers 0 to 5 (imr0 to imr5) (7.3.5 interrupt mask registers 0 to 5 (imr0 to imr5)). to disable the non-maskable interrupt, set the np bit of the psw to 1 to disable multiple interrupts (see 3.2.2 (2) program status word (psw)). for the nmi mask operation when reset is cleared, refer to the nmi reset status register (nrs) (7.3.6 nmi reset status register (nrs)). 3. when the internal instruction ram is accessed (in the write mode), programmable waits, address setup waits, and idle states can be inserted in the cs0 space. if none of the above states is set, the instruction ram is accessed using a 2 busclk frequency clock.
chapter 4 bus control function 170 preliminar y user ? s manual u16031ej2v1ud 4.10.3 cautions (1) disable all interrupts from when reset is cleared until when program codes are completely transferred to the internal instruction ram. it is not necessary to disable maskable interrupts because they are masked by default. because the software exception and exception trap cannot be masked, do not execute the trap and dbtrap instructions until transfer of program codes to the internal instruction ram is completed. (2) after reset has been cleared, the nmi input is masked by hardware. the nmi is unmasked as soon as the iramm0 bit of the iramm register has been cleared to 0. (3) to write data to instruction ram bank 0 of the internal instruction ram, set the np bit of the psw to 1 to disable the nmi and maskable interrupts and suppress occurrence of the software exception and exception trap. clear the np bit by setting the iramm0 bit of the iramm register to 1 and confirming that the read mode is set, after the program has been rewritten. (4) nmi or maskable interrupt requests that have been generated while the np bit of the psw is set to 1 are held pending. an nmi request is acknowledged immediately after the np bit has been cleared to 0. a maskable interrupt is acknowledged immediately after the np bit has been cleared to 0, if the interrupt request is not cleared (by clearing the xxifn bit of the interrupt control register (xxicn) to 0), if interrupts are not disabled (di status), and if the xxmkn bit of the interrupt control register is not set to 1 before the np bit is cleared to 0. however, only one interrupt request, nmi request or a maskable interrupt request, can be held pending per interrupt source. even if the same interrupt request is generated more than once, only the first interrupt request is acknowledged (xx: peripheral unit identification name (see table 7-2 ), n: peripheral unit number (see table 7-2 )). (5) when the internal instruction ram is accessed (in the write mode), the address bus and data bus output data. the external bus control signals other than uuwr, ulwr, luwr, llwr, and wr become active. if output of the iowr signal is enabled by setting the ioen bit of the bus cycle period control register (bcp) to 1, the iowr signal becomes active.
chapter 4 bus control function 171 preliminar y user ? s manual u16031ej2v1ud 4.11 bus hold function 4.11.1 function outline if the pcm2 and pcm3 pins are specified in the control mode, the hldak and hldrq functions become valid. if it is determined that the hldrq pin has become active (low level) as a bus mastership request from another bus master, the external address/data bus and each strobe pin are shifted to high impedance and then released (bus hold state). if the hldrq pin becomes inactive (high level) and the bus mastership request is canceled, driving of these pins begins again. during the bus hold period, the internal operations of the v850e/me2 continue until the external memory or a peripheral i/o register is accessed. the bus hold state can be known by the hldak pin becoming active (low level). the period from when the hldrq pin becomes active (low level) to when the hldak pin becomes active (low level) is at least 2 clocks. in a multiprocessor configuration, etc., a system with multiple bus masters can be configured. state data bus width access type timing at which bus hold request cannot be acknowledged between first and second accesses word access for 4n+1 address between second and third accesses word access for 4n+2 address betw een first and second accesses between first and second accesses word access for 4n+3 address between second and third accesses 32 bits halfword access for odd address between first and second accesses word access for even address betw een first and second accesses between first and second accesses word access for odd address between second and third accesses 16 bits halfword access for odd address between first and second accesses between first and second accesses between second and third accesses word access between third and forth accesses cpu bus lock 8 bits halfword access between first and second accesses read modify write access of bit manipulation instruction ?? between read access and write access cautions 1. when an external bus master accesses sdram during a bus hold state, make sure that the external bus master executes the all-bank precharge command. the cpu always executes the all-bank precharge command to release a bus hold state. in a bus hold state, do not allow an external bus master to change the sdram command register value. 2. the hldrq function is invalid during a reset period. the hldak pin becomes active either immediately after or after the insertion of a 1-clock address cycle from when the reset pin is set to inactive following the simultaneous activation of the reset and hldrq pins. when a bus master other than the v850e/me2 is externally connected, use the reset signal for bus arbitration at power-on.
chapter 4 bus control function 172 preliminar y user ? s manual u16031ej2v1ud 4.11.2 bus hold procedure the procedure of the bus hold function is illustrated below. <1> hldrq = 0 acknowledged <2> all bus cycle start requests held pending <3> end of current bus cycle <4> transition to bus idle state <5> hldak = 0 <6> hldrq = 1 acknowledged <7> hldak = 1 <8> pending bus cycle start requests released <9> start of bus cycle normal state bus hold state normal state hldak (output) hldrq (input) <1> <2> <3><4> <5> <6> <7><8><9> 4.11.3 operation in power-save mode in the software stop or idle mode, the internal system clock is stopped. consequently, the bus hold state is not set since the hldrq pin cannot be acknowledged even if it becomes active. in the halt mode, the hldak pin immediately becomes active when the hldrq pin becomes active, and the bus hold state is set. when the hldrq pin becomes inactive after that, the hldak pin also becomes inactive. as a result, the bus hold state is cleared and the halt mode is set again.
chapter 4 bus control function 173 preliminar y user ? s manual u16031ej2v1ud 4.11.4 bus hold timing (1) if bus hold request is issued when bus cycle is not generated busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 3 (output) d0 to d31 (input) wait (input) rd (output) hldrq (input) hldak (output) th ti note 1 th t0 note 2 ti note 1 undefined undefined ti note 1 notes 1. this idle state (ti) is independent of the bcc register setting. 2. state (t0) inserted between bus cycles 3. llwr/llbe/lldqm, uuwr/uube/uudqm, luwr/lube/ludqm, ulwr/ulbe/uldqm, we/wr, iord, iowr, sdras, sdcas remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 4 bus control function 174 preliminar y user ? s manual u16031ej2v1ud 4.11.5 bus hold timing (sram) (1) sram (when read, without speculative read, no idle state insertion) busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 4 (output) iord note 3 , rd (output) t1 t2 th ti note 2 th t0 note 1 t0 note 1 ti note 2 address undefined undefined hldrq (input) hldak (output) data d0 to d31 (input) wait (input) wr, iowr (output) notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is independent of the bcc register setting. 3. when the ioen bit of the bcp register is set to 1. 4. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 4 bus control function 175 preliminar y user ? s manual u16031ej2v1ud (2) sram (when read, with speculative read, no idle state insertion) busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 4 (output) iord note 3 , rd (output) t1 t2 th ti note 1 th t0 note 2 t2 ti note 1 address undefined undefined t1 hldrq (input) hldak (output) data d0 to d31 (input) wait (input) data wr, iowr (output) notes 1. this idle state (ti) is independent of the bcc register setting. 2. state (t0) inserted between bus cycles 3. when the ioen bit of the bcp register is set to 1. 4. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 4 bus control function 176 preliminar y user ? s manual u16031ej2v1ud (3) sram (when written, two idle states inserted) busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 5 (output) iowr note 4 , wr (output) th ti note 3 th t0 note 1 ti note 3 ti note 2 ti note 2 undefined undefined t1 t2 t0 note 1 address hldrq (input) hldak (output) d0 to d31 (input) wait (input) data rd, iord (output) notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is inserted by means of a bcc register setting. 3. this idle state (ti) is independent of the bcc register setting. 4. when the ioen bit of the bcp register is set to 1. 5. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 4 bus control function 177 preliminar y user ? s manual u16031ej2v1ud 4.11.6 bus hold timing (sdram) (1) sdram (when read, latency = 2, no idle state insertion) tread row tlate tlate tact busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) col . t0 note 1 row a12 (output) bnk . bank address (output) address note 4 (output) address h th th ti note 2 ti note 2 t0 note 1 tpre note 3 undefined undefined undefined undefined hldrq (input) hldak (output) undefined undefined undefined undefined d0 to d31 (input) data note 6 (output) h sdcke (output) note 5 (output) notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is independent of the bcc register setting. 3. the all-bank precharge command is always executed. 4. addresses other than the bank address, a12, and a2 to a11. 5. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 6. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state. 3. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 4. bnk.: bank address col.: column address row: row address
chapter 4 bus control function 178 preliminar y user ? s manual u16031ej2v1ud (2) sdram (when read, latency = 2, two idle states inserted, 32-bit bus width) tread row tlate tlate tact busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) col. t0 note 1 row a12 (output) bnk. bank address (output) address note 5 (output) address h th ti note 2 th ti note 3 t0 note 1 tpre note 4 undefined undefined undefined undefined hldrq (input) hldak (output) undefined undefined ti note 3 ti note 2 undefined undefined d0 to d31 (input) data note 6 (output) h sdcke (output) note 7 (output) notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is inserted by means of a bcc register setting. 3. this idle state (ti) is independent of the bcc register setting. 4. the all-bank precharge command is always executed. 5. addresses other than the bank address, a12, and a2 to a11. 6. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 7. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state. 3. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 4. bnk.: bank address col.: column address row: row address
chapter 4 bus control function 179 preliminar y user?s manual u16031ej2v1ud (3) sdram (when written) twr tact t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 4 (output) address row col. bnk.a row address undefined undefined undefined undefined undefined undefined th th ti note 2 ti note 2 t0 note 1 tpre note 3 hldrq (input) hldak (output) undefined undefined note 6 (output) d0 to d31 (i/o) data h sdcke (output) note 5 (output) notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is independent of the bcc register setting. 3. the all-bank precharge command is always executed. 4. addresses other than the bank address, a12, and a2 to a11. 5. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 6. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state. 3. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 4. bnk.: bank address col.: column address row: row address
chapter 4 bus control function 180 preliminar y user ? s manual u16031ej2v1ud (4) sdram (when written, when bus hold request acknowledged during on-page access) twr t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) note 5 (output) bcyst (output) we (output) d0 to d31 (i/o) sdcas (output) a12 (output) bank address (output) note 4 (output) col. address data undefined undefined undefined undefined undefined undefined th ti note 2 ti note 2 t0 note 1 tpre note 3 hldrq (input) hldak (output) undefined undefined th ti note 2 h sdcke (output) notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is independent of the bcc register setting. 3. the all-bank precharge command is always executed. 4. addresses other than the bank address, a12, and a2 to a11. 5. uudqm, uldqm, ludqm, lldqm remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state. 3. n = 1, 3, 4, 6 4. col.: column address
chapter 4 bus control function 181 preliminar y user ? s manual u16031ej2v1ud 4.12 bus priority order there are five external bus cycles: bus hold, instruction fetch, operand data access, dma cycle, and refresh cycle. in order of priority, bus hold is the highest, followed by the refresh cycle, dma cycle, operand data access, and instruction fetch, in that order. an instruction fetch may be inserted between a read access and write access during a read modify write access. also, an instruction fetch may be inserted between bus accesses when the cpu bus clock is used. table 4-2. bus priority order priority order external bus cycle bus master bus hold external device refresh cycle sdram controller dma cycle dma controller operand data access cpu high low instruction fetch cpu 4.13 boundary operation conditions 4.13.1 program space branching to the on-chip peripheral i/o area is prohibited. if the above is performed, undefined data is fetched, and fetching from the external memory is not performed. 4.13.2 data space the v850e/me2 is provided with an address misalign function. through this function, regardless of the data format (word or halfword), data can be allocated to all addresses. however, in the case of word data and halfword data, if the data is not subject to boundary alignment, the bus cycle will be generated at least 2 times and bus efficiency will drop. (1) external bus width: 16 bits (a) in the case of halfword-length data access when the address ? s lsb is 1, a byte-length bus cycle will be generated 2 times. (b) in the case of word-length data access (i) when the address ? s lsb is 1, bus cycles will be generated in the order of byte-length bus cycle, halfword-length bus cycle, and byte-length bus cycle. (ii) when the address ? s lower 2 bits are 10, a halfword-length bus cycle will be generated 2 times.
chapter 4 bus control function 182 preliminar y user ? s manual u16031ej2v1ud (2) external bus width: 32 bits (a) in the case of halfword-length data access when the address ? s lower 2 bits are 11, a byte-length bus cycle will be generated 2 times. (b) in the case of word-length data access when the address ? s lower 2 bits are 10, a halfword-length bus cycle will be generated 2 times. 4.14 timing at which t0 state is not inserted a t0 state is not inserted at the following timing. (1) read { during a refill operation when instruction cache is used (in the second and subsequent cycles) { during speculative reading (in the second and subsequent cycles) { if a read request (including a read request by instruction fetch or dma) is generated before a write operation to the external device is completed when a read operation occurs immediately after a write operation { if a read request (including a read request by instruction fetch or dma) that is greater than the bus width of the external device is generated (in the second and subsequent cycles) [example] ? 32-bit read access with 16-bit external bus width ? 32-bit or 16-bit read access with 8-bit external bus width (2) write { if a write request (including a write request by dma) is generated before a write operation to the external device is completed when a write operation occurs immediately after a write operation, and data is stored in the write buffer (a cycle in which the data stored in the write buffer is written to the external device) { if a write request (including a write request by dma) is generated during a speculative read operation (if data is stored in the write buffer) { if a write request (including a write request by dma) greater than the bus width of the external bus is generated (after the second and subsequent cycles) [example] ? 32-bit write access with external 16-bit bus width ? 32-bit or 16-bit write access with external 8-bit bus
183 preliminar y user?s manual u16031ej2v1ud chapter 5 memory access control function 5.1 sram, external rom, external i/o interface 5.1.1 features ? sram is accessed in a minimum of 2 states. ? up to 7 states of programmable data waits can be inserted by setting the dwc0 and dwc1 registers (dma flyby transfer: fwc register). ? data wait can be controlled via wait pin input. ? up to 3 idle states can be inserted after a read/write cycle by setting the bcc register (dma flyby transfer: fic register). ? up to 3 address setup wait states can be inserted by setting the asc register. ? dma flyby transfer can be activated (sram external i/o, external i/o sram)
chapter 5 memory access control function 184 preliminar y user?s manual u16031ej2v1ud 5.1.2 sram connection examples of connection to sram are shown below. figure 5-1. examples of connection to sram (1/2) (a) when data bus width is 8 bits v850e/me2 a2 to a18 d24 to d31 csn rd uuwr d16 to d23 ulwr d8 to d15 luwr d0 to d7 llwr a0 to a16 i/o1 to i/o8 cs oe we a0 to a16 i/o1 to i/o8 cs oe we a0 to a16 i/o1 to i/o8 cs oe we a0 to a16 i/o1 to i/o8 cs oe we sram (128 kwords 8 bits) sram (128 kwords 8 bits) sram (128 kwords 8 bits) sram (128 kwords 8 bits) remark n = 0 to 7
chapter 5 memory access control function 185 preliminar y user ? s manual u16031ej2v1ud figure 5-1. examples of connection to sram (2/2) (b) when data bus width is 16 bits v850e/me2 a2 to a19 d16 to d31 csn rd uube ulbe wr d0 to d15 lube llbe a0 to a17 i/o1 to i/o16 cs oe hb lb we sram (256 kwords 16 bits) a0 to a17 i/o1 to i/o16 cs oe hb lb we sram (256 kwords 16 bits) remark n = 0 to 7
chapter 5 memory access control function 186 preliminar y user ? s manual u16031ej2v1ud 5.1.3 sram, external rom, external i/o access figure 5-2. sram, external rom, external i/o access timing (1/10) (a) when read (without speculative read) t2 tw t0 note 1 t0 note 1 t0 note 1 data data busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) rd (output) t1 t2 t1 address address notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 187 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (2/10) (b) when read (without speculative read, address setup wait, idle state insertion) t2 ti t0 note 1 data busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) rd (output) t1 tasw t0 note 1 address notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 188 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (3/10) (c) when read (with speculative read, 32-bit bus width) data data data data t1 t2 t1 t2 t1 t2 t1 t2 busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) rd (output) t0 note 1 t0 note 1 address a address a+4 address a+c address a+8 notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 189 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (4/10) (d) when read (with speculative read, access on another line) penalty cycle accompanying with another line access request address b address a data data data data t1 t2 t1 t2 t1 t2 t1 t2 t1 t2 speculative read cycle (fill cycle of speculative read buffer) speculative read cycle busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) rd (output) address a+4 address a+8 address a+c data t0 note 1 access by cpu read from address (a) read from address (b) notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 190 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (5/10) (e) when read (with speculative read, 32-bit bus width, address setup wait, idle state insertion) data t1 t2 tasw ti address a+c data t1 t2 tasw ti address a+8 data t1 t2 tasw ti address a+4 data t1 t2 tasw ti address a busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) rd (output) t0 note 1 t0 note 1 notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 191 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (6/10) (f) when written (1/2) access by cpu wr (output) busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (output) wait (input) data t1 t2 t1 t0 note 1 address a write to address (a) write to address (b) data t2 tw address b t0 note 1 t0 note 1 (f) when written (2/2) access by cpu data wr (output) busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (output) wait (input) data t1 t2 t1 t2 tw t0 note 1 address a address b write to address (a) write to address (b) t0 note 1 notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 192 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (7/10) (g) when written (address setup wait, idle state insertion) t1 t2 tasw ti t0 note 1 data wr (output) busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (output) wait (input) address notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 193 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (8/10) (h) for read (without speculative read) write operation t1 t2 t1 t2 t0 note 1 t0 note 1 wr (output) data data busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) rd (output) address address notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 194 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (9/10) (i) for write read operation (1/2) access by cpu data data busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) rd (output) t1 t2 t1 t2 t0 note 1 address a address b t0 note 1 wr (output) write to address (a) read from address (b) notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 195 preliminar y user ? s manual u16031ej2v1ud figure 5-2. sram, external rom, external i/o access timing (10/10) (i) for write read operation (2/2) wr (output) access by cpu write to address (a) read from address (b) data data busclk (output) a0 to a25 (output) cs0 to cs7 (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) rd (output) t1 t2 t1 t2 t0 note 1 address a address b notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 196 preliminar y user ? s manual u16031ej2v1ud 5.2 page rom controller (romc) the page rom controller (romc) is provided for accessing rom (page rom) with a page access function. addresses are compared with the immediately preceding bus cycle and wait control for normal access (off-page) and page access (on-page) is executed. this controller can handle page widths from 8 to 128 bytes. 5.2.1 features ? direct connection to 8-bit/16-bit/32-bit page rom supported ? for 32-bit bus width: 2/4/8/16/32-word page access supported for 16-bit bus width: 4/8/16/32/64-word page access supported for 8-bit bus width: 8/16/32/64/128-word page access supported ? page rom is accessed in a minimum of 2 states. ? on-page judgment function ? addresses to be compared can be changed by setting the prc register. ? up to 7 states of programmable data waits can be inserted by setting the following registers. during on-page cycle: prc register during off-page cycle: dwc0 and dwc1 registers during dma flyby cycle: fwc register ? waits can be controlled via wait pin input. ? dma flyby cycle can be activated (page rom external i/o) ? sram write cycle is started when a write cycle request is issued to a csn space (n = 0 to 7) where page rom is located
chapter 5 memory access control function 197 preliminar y user ? s manual u16031ej2v1ud 5.2.2 page rom connection examples of connection to page rom are shown below. figure 5-3. examples of connection to page rom (a) when data bus width is 16 bits v850e/me2 a2 to a21 d16 to d31 csn rd d0 to d15 a0 to a19 o0 to o15 ce oe page rom (1 mword 16 bits) a0 to a19 o0 to o15 ce oe page rom (1 mword 16 bits) (b) when data bus width is 8 bits v850e/me2 a2 to a22 d24 to d31 csn rd d16 to d23 d8 to d15 d0 to d7 a0 to a20 o0 to o7 ce oe page rom (2 mwords 8 bits) a0 to a20 o0 to o7 ce oe page rom (2 mwords 8 bits) a0 to a20 o0 to o7 ce oe page rom (2 mwords 8 bits) a0 to a20 o0 to o7 ce oe page rom (2 mwords 8 bits) remark n = 0 to 7
chapter 5 memory access control function 198 preliminar y user ? s manual u16031ej2v1ud 5.2.3 on-page/off-page judgment whether a page rom cycle is on-page or off-page is judged by latching the address of the previous cycle and comparing it with the address of the current cycle. if no speculative reading is specified (rbn1 and rbn0 bits of the lbcm register = 00, 01), an off-page cycle is always started (m = 0, 1, n = 0 to 7). one of the addresses (a3 to a6) is set as the masking address (no comparison is made) according to the configuration of the connected page rom and the number of continuously readable bits set by the page rom configuration register (prc). an example of controlling address masking when four page roms of 1 mword 8 bits are connected is shown below. figure 5-4. example of control by ma6 to ma3 bits of prc register a25 a24 a23 a22 a21 a7 a6 a5 a4 a3 a25 a24 a23 a22 a21 a7 a6 a5 a4 a3 a2 a1 a0 a0 internal address latch (immediately preceding address) v850e/me2 address output page rom address a19 off-page address on-page address a5 a4 a3 a2 a1 ma6 0 ma5 0 ma4 0 ma3 1 prc register setting note comparison note not used with a 32-bit data bus width
chapter 5 memory access control function 199 preliminar y user ? s manual u16031ej2v1ud 5.2.4 page rom configuration register (prc) this register specifies whether page rom cycle on-page access is enabled or disabled. if on-page access is enabled, the masking address (no comparison is made) out of the addresses (a3 to a6) corresponding to the configuration of the connected page rom and the number of bits that can be read continuously, as well as the number of waits corresponding to the internal system clock, are set. this register can be read or written in 16-bit units. caution write to the prc register after reset, and then do not change the set value. also, do not access an external memory area other than the one for this initialization routine until the initial setting of the prc register is complete. however, it is possible to access external memory areas whose initialization settings are complete. 15 0 prc address fffff49ah after reset 7000h 14 prw2 13 prw1 12 prw0 11 0 10 0 9 0 8 0 7 0 6 0 5 0 4 0 3 ma6 2 ma5 1 ma4 0 ma3 bit position bit name function sets the number of waits corresponding to the internal system clock. the number of waits set by these bits is inserted only for on-page access. for off-page access, the waits set by registers dwc0 and dwc1 are inserted. prw2 prw1 prw0 number of inserted wait cycles 0000 0011 0102 0113 1004 1015 1106 1117 14 to 12 prw2 to prw0 each respective address (a6 to a3) corresponding to ma6 to ma3 is masked (by 1). the masked address is not subject to comparison during on/off-page judgment, and is set according to the number of continuously readable bits. ma6 ma5 ma4 ma3 number of continuously readable bits 00002 32 bits, 4 16 bits, 8 8 bits 00014 32 bits, 8 16 bits, 16 8 bits 00118 32 bits, 16 16 bits, 32 8 bits 0 1 1 1 16 32 bits, 32 16 bits, 64 8 bits 1 1 1 1 32 32 bits, 64 16 bits, 128 8 bits other than above setting prohibited (the operation cannot be guaranteed if other bits are set.) 3 to 0 ma6 to ma3
chapter 5 memory access control function 200 preliminar y user ? s manual u16031ej2v1ud 5.2.5 page rom access figure 5-5. page rom access timing (1/6) (a) when read (without speculative read, 32-bit bus width, other than cache fill operation) t1 t2 t1 t2 t1 t2 t1 t2 t0 note 1 t0 note 1 t0 note 1 t0 note 1 data busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) off-page address off-page address h data data data off-page address off-page address t0 note 1 notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 201 preliminar y user ? s manual u16031ej2v1ud figure 5-5. page rom access timing (2/6) (b) when read (without speculative read, 32-bit bus width, cache fill operation) busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 3 (output) d0 to d31 (input) wait (input) t1 t2 to1 to2 to1 to2 to1 to2 h address a address a+4 address a+8 address a+c data data data data t0 note 1 t0 note 1 tw note 2 on-page on-page on-page off-page notes 1. state (t0) inserted between bus cycles 2. programmable wait = 1 wait insertion 3. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 202 preliminar y user ? s manual u16031ej2v1ud figure 5-5. page rom access timing (3/6) (c) when read (with speculative read, 32-bit bus width) data t1 tw tw tw t2 to1 tow to2 to1 tow to2 to1 tow to2 data data data address a+8 address a+c address a+4 busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) address a t0 note 1 h t0 note 1 on-page on-page on-page off-page notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 203 preliminar y user ? s manual u16031ej2v1ud figure 5-5. page rom access timing (4/6) (d) when read (without speculative read, address setup wait, idle state insertion, 32-bit bus width, other than cache fill operation) t0 note 1 t1 t2 tasw ti t0 note 1 t1 t2 tasw ti t1 t2 tasw ti t0 note 1 t1 t2 tasw ti t0 note 1 t0 note 1 busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) h off-page address data off-page address data off-page address data off-page address data notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 204 preliminar y user ? s manual u16031ej2v1ud figure 5-5. page rom access timing (5/6) (e) when read (without speculative read, address setup wait, idle state insertion, 32-bit bus width, cache fill operation) on-page on-page on-page off-page data address a0 address a+4 address a+8 tasw t1 t2 to1 to2 to1 to2 to1 to2 ti address a+c data data data busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) t0 note 1 h notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 205 preliminar y user ? s manual u16031ej2v1ud figure 5-5. page rom access timing (6/6) (f) when read (with speculative read, address setup wait, idle state insertion, 32-bit bus width) data tasw t1 tw tw tw t2 to1 tow to2 to1 tow to2 to1 tow to2 data data data address a+8 address a+c address a+4 busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 2 (output) d0 to d31 (input) wait (input) address a t0 note 1 ti h on-page on-page on-page off-page notes 1. state (t0) inserted between bus cycles 2. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 5 memory access control function 206 preliminar y user ? s manual u16031ej2v1ud 5.3 dram controller (sdram) 5.3.1 features ? burst length: 1 ? wrap type: sequential ? cas latency: 1, 2, and 3 supported (only 2 and 3 supported during dma flyby transfer) ? 4 types of sdram can be assigned to 4 memory blocks. ? row and column address multiplex widths can be changed. ? waits (0 to 3 waits) can be inserted between the bank active command and the read/write command. ? supports cbr refresh and cbr self-refresh. 5.3.2 sdram connection an example of connection to sdram is shown below. figure 5-6. example of connection to sdram v850e/me2 a2 to a13 a22, a23 note d16 to d31 busclk sdcke csn sdras sdcas uudqm uldqm we d0 to d15 ludqm lldqm a0 to a11 a12, a13 dq0 to dq15 clk cke cs ras cas hdqm ldqm we sdram (1 mword 16 bits 4 banks) a0 to a11 a12, a13 dq0 to dq15 clk cke cs ras cas hdqm ldqm we sdram (1 mword 16 bits 4 banks) note the address signals to be used differ depending on the sdram product. remark n = 1, 3, 4, 6
chapter 5 memory access control function 207 preliminar y user ? s manual u16031ej2v1ud 5.3.3 address multiplex function depending on the value of the sawn0 and sawn1 bits in sdram configuration register n (scrn), the row address output in the sdram cycle is multiplexed as shown in figure 5-7 (a) (n = 1, 3, 4, 6). depending on the value of the sson0 and sson1 bits, the column address output in the sdram cycle is multiplexed as shown in figure 5-7 (b) (n = 1, 3, 4, 6). in figures 5-7 (a) and (b), a0 to a25 indicate the addresses output from the cpu, and a0 to a25 indicate the address pins of the v850e/me2. figure 5-7. row address/column address output (1/2) (a) row address output a14 a25 a13 a24 a12 a23 a2 a13 a3 a14 a4 a15 a5 a16 a6 a17 a7 a18 a8 a19 a9 a20 a10 a21 a11 a22 a15 a15 a16 a16 a17 a17 a25 to a18 a25 to a18 a1 a12 a0 a11 a17 a16 a25 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 to a18 a14 a13 a12 a11 a10 row address (sawn1, sawn0 = 11) address pin row address (sawn1, sawn0 = 10) a25 a24 a23 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a17 a25 to a18 a12 a11 a10 a9 a25 a24 a23 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a25 to a18 a12 a11 a10 a9 a8 row address (sawn1, sawn0 = 01) row address (sawn1, sawn0 = 00) remark n = 1, 3, 4, 6 (b) column address output (using all-bank precharge command) a14 a14 a13 a13 a12 a12 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 1 a11 a11 a15 a15 a16 a16 a17 a17 a25 to a18 a25 to a18 a1 a1 a0 a0 a16 a15 a14 a4 a5 a6 a7 a8 a9 a10 1 a12 a13 a17 a25 to a18 a3 a2 a1 a0 column address (sson1, sson0 = 00) address pin column address (sson1, sson0 = 01) a16 a15 a14 a4 a5 a6 a7 a8 a9 a10 a11 1 a13 a17 a25 to a18 a3 a2 a1 a0 column address (sson1, sson0 = 10) remark n = 1, 3, 4, 6 (c) column address output (using register write command) a14 0 a13 0 a12 0 a2 0 a3 0 a4 ltm0 a5 lt m 1 a6 ltm2 a7 0 a8 0 a9 0 a10 0 a11 0 a15 0 a16 0 a17 0 a25 to a18 0 a1 0 a0 0 000 0 0 lt m 0 lt m 1 ltm2 0 0 0 0 0 0 0 0 00 0 column address (sson1, sson0 = 00) address pin column address (sson1, sson0 = 01) 000 0 0 0 lt m 0 ltm1 ltm2 0 0 0 0 0 0 0 00 0 column address (sson1, sson0 = 10) remark n = 1, 3, 4, 6
chapter 5 memory access control function 208 preliminar y user ? s manual u16031ej2v1ud figure 5-7. row address/column address output (2/2) (d) column address output (using read/write command) a14 a14 a13 a12 a12 a11 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 0 a11 a10 a15 a15 a16 a16 a17 a17 a25 to a18 a25 to a18 a1 a1 a0 a0 a16 a15 a14 a4 a5 a6 a7 a8 a9 a10 0 a11 a12 a17 a25 to a18 a3 a2 a1 a0 column address (sson1, sson0 = 00) address pin column address (sson1, sson0 = 01) a16 a15 a14 a4 a5 a6 a7 a8 a9 a10 a11 0 a12 a17 a25 to a18 a3 a2 a1 a0 column address (sson1, sson0 = 10) remark n = 1, 3, 4, 6
chapter 5 memory access control function 209 preliminar y user ? s manual u16031ej2v1ud 5.3.4 sdram configuration registers 1, 3, 4, 6 (scr1, scr3, scr4, scr6) these registers specify the number of waits and the address multiplex width. scrn corresponds to csn (n = 1, 3, 4, 6). for example, to connect sdram to cs1, set scr1. these registers can be read or written in 16-bit units. cautions 1. an sdram read/write cycle is not generated prior to executing a register write operation. access sdram after reading the value of the scrn register and confirming that the wcfn bit is set to 1. 2. to write to the scrn register again following access to sdram, clear the men bit of the bct0 and bct1 registers to 0, and then set it to 1 again before performing access (n = 0 to 6). 3. do not execute continuous instructions to write to the scrn register. be sure to insert another instruction between commands to write to the scrn register. 4. start accessing sdram after all the scrn registers have been set. (1/3) 14 ltm12 13 ltm11 12 ltm10 2 raw10 3 raw11 4 sso10 5 sso11 6 bcw10 7 bcw11 8 wcf1 9 0 10 0 11 0 15 0 1 saw11 0 saw10 ltm32 ltm31 ltm30 raw30 raw31 sso30 sso31 bcw30 bcw31 wcf3 0 0 0 0 saw31 saw30 ltm42 ltm41 ltm40 raw40 raw41 sso40 sso41 bcw40 bcw41 wcf4 0 0 0 0 saw41 saw40 ltm62 ltm61 ltm60 raw60 raw61 sso60 sso61 bcw60 bcw61 wcf6 0 0 0 0 saw61 saw60 scr1 scr3 scr4 scr6 address fffff4a4h fffff4ach fffff4b0h fffff4b8h after reset 30c0h 30c0h 30c0h 30c0h bit position bit name function sets the cas latency value for reading. ltmn2 ltmn1 ltmn0 latency 0 0 1 1 (setting prohibited during dma flyby transfer) 0102 0113 other than above setting prohibited 14 to 12 ltmn2 to lt m n 0 8 wcfn indicates that execution of a register write command on sdram has been completed after the scrn register was set. this bit is set to 1 when a register write command is generated. this bit can only be read. 0: setting not completed 1. setting completed remark n = 1, 3, 4, 6
chapter 5 memory access control function 210 preliminar y user ? s manual u16031ej2v1ud (2/3) bit position bit name function specifies the number of wait states inserted from the bank active command to a read/write command, or from the precharge command to the bank active command. bcwn1 bcwn0 number of wait states inserted 0 0 setting prohibited 011 102 113 7, 6 bcwn1, bcwn0 specifies the address shift width during on-page judgment. if the external data bus width is set to 16 or 32 bits, the system does not use the lower address (a0 or a1, a0). set these bits in accordance with the contents of the lbs register corresponding to csn. sson1 sson0 address shift width 0 0 0 bits (external data bus width: 8 bits) 0 1 1 bit (external data bus width: 16 bits) note 1 0 2 bits (external data bus width: 32 bits) note 1 1 setting prohibited 5, 4 sson1, sson0 specifies the row address width. rawn1 rawn0 row address width 0 0 11 bits 0 1 12 bits note 1 0 13 bits note 1 1 setting prohibited 3, 2 rawn1, rawn0 specifies the address multiplex width (column address width) during sdram access. sawn1 sawn0 address multiplex width (column address width) 0 0 8 bits 0 1 9 bits 1 0 10 bits note 1 1 11 bits note 1, 0 sawn1, sawn0 remarks 1. the note is described on the next page. 2. n = 1, 3, 4, 6
chapter 5 memory access control function 211 preliminar y user ? s manual u16031ej2v1ud (3/3) note the following setting is prohibited because the upper limit of the address is exceeded. sson1 sson0 rawn1 rawn0 sawn1 sawn0 setting 011011data bus width: 16 bits row address width: 13 bits column address width: 11 bits 100111data bus width: 32 bits row address width: 12 bits column address width: 11 bits 0 data bus width: 32 bits row address width: 13 bits column address width: 10 bits 10101 1 data bus width: 32 bits row address width: 13 bits column address width: 11 bits remark n = 1, 3, 4, 6
chapter 5 memory access control function 212 preliminar y user ? s manual u16031ej2v1ud 5.3.5 sdram access during power-on or a refresh operation, the all-bank precharge command is always issued for sdram. when accessing sdram after that, therefore, the active command and read/write command are issued in that order (see <1> in figure 5-8). if a page change occurs following this, the precharge command, active command, and read/write command are issued in that order (see <2> in figure 5-8). if a bank change occurs, the active command and read/write command for the bank to be accessed next are issued in that order. following this read/write command, the precharge command for the bank that was accessed before the bank currently being accessed will be issued (see <3> in figure 5-8). figure 5-8. state transition of sdram access <1> <3> <2> all-bank precharge command (power on/refresh) bank a active command bank a precharge command bank a active command bank a active command bank b active command bank b read/write command bank a read/write command bank a read/write command read/write command read/write command (on-page access) (page change) (bank change) (bank change) bank a precharge command
chapter 5 memory access control function 213 preliminar y user ? s manual u16031ej2v1ud (1) sdram single read cycle the sdram single read cycle is a cycle for reading from sdram by executing a load instruction (ld) for the sdram area, by fetching an instruction, or by 2-cycle dma transfer. in the sdram single read cycle, the active command (act) and read command (rd) are issued to sdram in that order. during on-page access, however, only the read command is issued and the precharge command and active command are not issued. when a page change occurs in the same bank, the precharge command (pre) is issued before the active command. a one-state t0 cycle is always inserted immediately before all read commands activated by the cpu. the number of idle states (ti) set by the bus cycle control register (bcc) are inserted after the read cycle (no idle states are inserted, however, if bcn1 and bcn0 are 00) (n = 1, 3, 4, 6). the timing charts of the sdram single read cycle are shown below. caution when executing a write access to sram or external i/o after read accessing sdram, data conflict may occur depending on the sdram data output float delay time. in such a case, avoid data conflict by inserting an idle state in the sdram space via a setting in the bcc register.
chapter 5 memory access control function 214 preliminar y user ? s manual u16031ej2v1ud figure 5-9. sdram single read cycle (1/5) (a) during off-page access (when latency = 2, bcw = 1) tread tlate tlate tact t0 note 1 t0 note 1 row busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) col. act rd row a12 (output) address bnk. bank address (output) address address note 2 (output) address h latency = 1 d0 to d31 (input) note 4 (output) data command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 215 preliminar y user ? s manual u16031ej2v1ud figure 5-9. sdram single read cycle (2/5) (b) during off-page access (latency = 2, idle state 2 insertion) tread row tlate tlate tact busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) col. t0 note 1 row a12 (output) address bnk. bank address (output) address address note 2 (output) address h latency = 2 d0 to d31 (input) note 4 (output) data ti ti t0 note 1 act rd command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 216 preliminar y user ? s manual u16031ej2v1ud figure 5-9. sdram single read cycle (3/5) (c) during off-page access (when latency = 2, page change, bcw = 1) tread row tlate tlate tact busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) col. t0 note 1 row a12 (output) address bnk. bank address (output) address address note 2 (output) address h row row col. address bnk. address address address act rd pre row latency = 2 d0 to d31 (input) data latency = 2 note 4 (output) data page change tact tread tlate tlate tprec t0 note 1 t0 note 1 act rd command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 217 preliminar y user ? s manual u16031ej2v1ud figure 5-9. sdram single read cycle (4/5) (d) during off-page access (latency = 2, bank change) tact tread tlate tlate row col. row address bnk.b address address address row bnk.a address address address address tread row tlate tlate tact busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) col. t0 note 1 act rd row a12 (output) address bnk.a bank address (output) address address note 2 (output) address h latency = 2 bank change data latency = 2 d0 to d31 (input) note 4 (output) data t0 note 1 t0 note 1 act(bnk.b) rd pre(bnk.a) command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 218 preliminar y user ? s manual u16031ej2v1ud figure 5-9. sdram single read cycle (5/5) (e) during on-page access (when latency = 2, 32-bit bus width) tread tlate tlate latency = 2 t0 note 1 h h busclk (output) a2 to a11 (output) csn (output) sdras (output) note 3 (output) bcyst (output) we (output) d0 to d31 (input) sdcas (output) a12 (output) bank address (output) note 2 (output) col. col. address address address address rd address address data t0 note 1 command notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. uudqm, uldqm, ludqm, lldqm remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address
chapter 5 memory access control function 219 preliminar y user ? s manual u16031ej2v1ud (2) sdram single write cycle the sdram single write cycle is a cycle for writing to sdram by executing a write instruction (st) for the sdram area or by 2-cycle dma transfer. in the sdram single write cycle, the active command (act) and write command (wr) are issued to sdram in that order. during on-page access, however, only the write command is issued and the precharge command and active command are not issued. when a page change occurs in the same bank, the precharge command (pre) is issued before the active command. a one-state tw cycle is always inserted immediately before all write commands activated by the cpu. the timing charts of the sdram single write cycle are shown below.
chapter 5 memory access control function 220 preliminar y user ? s manual u16031ej2v1ud figure 5-10. sdram single write cycle (1/6) (a) during off-page access twr tact t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 2 (output) address row col. wr act(bnk.a) bnk.a row d0 to d31 (i/o) data note 4 (output) command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 221 preliminar y user ? s manual u16031ej2v1ud figure 5-10. sdram single write cycle (2/6) (b) page change (1/2) twr tact tw tact twr tprec t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 2 (output) address row col.(a) wr act(bnk.a) address address act(bnk.a) pre(bnk.a) address address wr bnk.a row row row col.(b) bnk.a address address address address page change d0 to d31 (i/o) note 4 (output) data data access by cpu write to address (a) write to address (b) command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 222 preliminar y user?s manual u16031ej2v1ud figure 5-10. sdram single write cycle (3/6) (b) page change (2/2) access by cpu write to address (a) write to address (b) twr tact t0 note 1 tact twr tprec t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 2 (output) address row col.(a) wr act(bnk.a) address address act(bnk.a) pre(bnk.a) address wr bnk.a row row row col.(b) bnk.a address address address address page change d0 to d31 (i/o) note 4 (output) data data command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 223 preliminar y user ? s manual u16031ej2v1ud figure 5-10. sdram single write cycle (4/6) (c) bank change (1/2) access by cpu write to address (a) write to address (b) twr tact tw t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 2 (output) address row col.(a) wr act(bnk.a) address address address bnk.a row address tact wpre wend twr wr act(bnk.b) pre(bnk.a) address row col.(b) bnk.b row address row bnk.a address address address address address address address bank change d0 to d31 (i/o) data note 4 (output) data command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 224 preliminar y user ? s manual u16031ej2v1ud figure 5-10. sdram single write cycle (5/6) (c) bank change (2/2) access by cpu twr tact t0 note 1 t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a12 (output) command note 2 (output) address row col.(a) wr act(bnk.a) address address address bnk.a row address tact wpre wend twr wr act(bnk.b) pre(bnk.a) address row col.(b) bnk.b row address row bnk.a address address address address address address address write to address (a) write to address (b) bank change d0 to d31 (i/o) data note 4 (output) data command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 225 preliminar y user ? s manual u16031ej2v1ud figure 5-10. sdram single write cycle (6/6) (d) during on-page access (32-bit bus width) twr h t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) note 3 (output) bcyst (output) we (output) d0 to d31 (i/o) sdcas (output) a12 (output) bank address (output) note 2 (output) data wr col. (a) address address address command notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. uudqm, uldqm, ludqm, lldqm remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address
chapter 5 memory access control function 226 preliminar y user ? s manual u16031ej2v1ud (3) sdram access timing control the sdram access timing can be controlled by sdram configuration register n (scrn) (n = 1, 3, 4, 6). for details, see 5.3.4 sdram configuration registers 1, 3, 4, 6 (scr1, scr3, scr4, scr6) . caution wait control by the wait pin is not available during sdram access. (a) number of waits from bank active command to read/write command the number of wait states from bank active command issue to read/write command issue can be set by setting the bcwn1 and bcwn0 bits of the scrn register. bcwn1, bcwn0 = 01b: 1 wait bcwn1, bcwn0 = 10b: 2 waits bcwn1, bcwn0 = 11b: 3 waits (b) number of waits from precharge command to bank active command the number of wait states from precharge command issue to bank active command issue can be set by setting the bcwn1 and bcwn0 bits of the scrn register. bcwn1, bcwn0 = 01b: 1 wait bcwn1, bcwn0 = 10b: 2 waits bcwn1, bcwn0 = 11b: 3 waits (c) cas latency setting when read the cas latency during a read operation can be set by setting the ltmn2 to ltmn0 bits of the scrn register. ltmn2 to ltmn0 = 001b: latency = 1 (setting prohibited during dma flyby transfer) ltmn2 to ltmn0 = 010b: latency = 2 ltmn2 to ltmn0 = 011b: latency = 3 (d) number of waits from refresh command to next command the number of wait states from refresh command issue to next command issue can be set by setting the bcwn1 and bcwn0 bits of the scrn register. the number of wait states becomes four times the value set by bcwn1 and bcwn0 bits. bcwn1, bcwn0 = 01b: 4 waits bcwn1, bcwn0 = 10b: 8 waits bcwn1, bcwn0 = 11b: 12 waits
chapter 5 memory access control function 227 preliminar y user?s manual u16031ej2v1ud figure 5-11. sdram access timing (1/9) (a) when read (with speculative read, 32-bit bus width, bcw = 2, latency = 2) act rd rd tread tread tread tact t0 note 1 tbcw tlate tlate tread row busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) col.(a) row a12 (output) address bnk bank address (output) address address note 2 (output) address h col.(a+4) address address address rd rd col.(a+8) col.(a+c) undefined undefined undefined undefined latency = 2 d0 to d31 (input) note 4 (output) data data data data latency = 2 latency = 2 latency = 2 command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 228 preliminar y user?s manual u16031ej2v1ud figure 5-11. sdram access timing (2/9) (b) when read (with speculative read, access on another line, 32-bit bus width, bcw = 2, latency = 2) rd rd rd rd rd tread row tread tread tact busclk (output) a2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) col.(a) t0 note 1 act row a12 (output) address bnk. bank address ( output ) address address note 2 (outputs) address h tbcw col.(a+4) address address address tlate tlate tread col.(a+8) col.(a+c) undefined undefined undefined undefined address address address col.(b) tw tread access by cpu read from address (a) read from address (b) command latency = 2 d0 to d31 (input) note 4 (output) data data data data speculative read cycle (fill cycle of speculative read buffer) speculative read cycle latency = 2 latency = 2 latency = 2 note 3 (output) penalty cycle accompanying request to access another line notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 229 preliminar y user ? s manual u16031ej2v1ud figure 5-11. sdram access timing (3/9) (c) when read (16-bit bus width, cache fill operation, latency = 3) tread tlate tread tread tread tread tread tread tread tlate tlate h h latency = 3 t0 note 1 busclk (output) a1 to a10 (output) csn (output) sdras (output) note 3 (output) bcyst (output) we (output) d0 to d15 (i/o) sdcas (output) a11 (output) bank address (output) note 2 (output) col. (a) col. (a+2) rd rd rd rd col . (a+4) undefined data data data data rd rd rd rd col . (a+6) col. (a+8) col. (a+a) col. (a+c) col. (a+e) address address address undefined address address address address address address address address undefined address address address address address address address address undefined address address address address address data data data data t0 note 1 latency = 3 latency = 3 latency = 3 latency = 3 latency = 3 latency = 3 latency = 3 command notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a11, and a1 to a10. 3. uudqm, uldqm, ludqm, lldqm remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address
chapter 5 memory access control function 230 preliminar y user ? s manual u16031ej2v1ud figure 5-11. sdram access timing (4/9) (d) for read write operation (with speculative read, latency = 2, 32-bit bus width) (1/2) wr rd latency = 2 access by cpu read from address (a) note 4 note 5 write to address (a) data data address h data data speculative read cycle (fill cycle of speculative read buffer) write cycle tread tread tread tread tlate tlate tw twr t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) note 3 (output) bcyst (output) we (output) d0 to d31 (i/o) sdcas (output) a12 (output) bank address (output) note 2 (output) col. (a) col. (a+4) rd address address rd rd col. (a+8) col. (a+c) col. (a) address address address data penalty cycle accompanying with another line access request latency = 2 latency = 2 latency = 2 command notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. uudqm, uldqm, ludqm, lldqm 4. read from address (a+4) 5. read from address (a+8) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address
chapter 5 memory access control function 231 preliminar y user ? s manual u16031ej2v1ud figure 5-11. sdram access timing (5/9) (d) for read write operation (with speculative read, latency = 2, 32-bit bus width) (2/2) wr rd latency = 2 speculative read cycle (fill cycle of speculative r ead buffer) write cycle access by cpu read from address (a) note 4 note 5 write to (a) note 6 data data address h data data tread tread tread tread tlate tlate t0 note 1 twr t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) note 3 (output) bcyst (output) we (output) d0 to d31 (i/o) sdcas (output) a12 (output) bank address (output) note 2 (output) col. (a) col. (a+4) rd address address rd rd col. (a+8) col. (a+c) col. (a) address address address data latency = 2 latency = 2 latency = 2 command notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. uudqm, uldqm, ludqm, lldqm 4. read from address (a+4) 5. read from address (a+8) 6. read from address (a+c) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address
chapter 5 memory access control function 232 preliminar y user?s manual u16031ej2v1ud figure 5-11. sdram access timing (6/9) (e) when read (without speculative read, 16-bit bus width word access, page change, bcw = 2, latency = 2) tread tlate tlate tact tbcw tact tbcw tbcw tread tlate tlate tprec t0 note 1 tread row col. act(bnk.a) rd row address bnk.a address address address busclk (output) a 1 to a10 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a11 (output) bank address (output) note 2 (output) rd col. address address address row col. row address bnk.a address address address col. address address address tread address address address address row row bnk.a address act(bnk.a) rd rd pre(bnk.a) t0 note 1 undefined undefined undefined undefined t0 note 1 undefined undefined undefined undefined bcw bcw bcw latency = 2 note 4 (output) d0 to d15 (input) data data data data latency = 2 page change latency = 2 latency = 2 command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a11, and a1 to a10 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 233 preliminar y user?s manual u16031ej2v1ud figure 5-11. sdram access timing (7/9) (f) when read (without speculative read, 16-bit bus width word access, bank change, bcw = 2, latency = 2) tread tlate tlate tact tbcw tact tbcw tread tlate tlate t0 note 1 tread act(bnk.a) rd busclk (output) a1 to a10 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a11 (output) bank address (output) note 2 (output) rd tread act(bnk.b) rd rd pre(bnk.a) t0 note 1 t0 note 1 d0 to d15 (input) bank change row col. row address bnk.a address address address col. address address address col. address address address col. address address address row row bnk.b address undefined bnk.a undefined undefined undefined undefined undefined undefined undefined undefined undefined bcw bcw latency = 2 data data data data latency = 2 latency = 2 latency = 2 command note 4 (output) note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 234 preliminar y user?s manual u16031ej2v1ud figure 5-11. sdram access timing (8/9) (g) for write read operation twr tact tbcw tw tact tbcw tbcw twr tprec tw tact tbcw tlate tlate tread t0 note 1 address row col.(a) wr act(bnk.a) address address bnk.a row address wr act(bnk.a) pre(bnk.a) address address row address address address address address row address row bnk.a address bnk.a address busclk (output) a 2 to a11 (output) csn (output) sdras (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 2 (output) act(bnk.b) rd pre(bnk.a) address address row address address address col.(c) address row bnk.b address col.(b) address address address address address address address address row bnk.a address bcw bcw bcw bcw page change bank change latency = 2 note 4 (output) d0 to d31 (i/o) data data data access by cpu write to (a) write to (b) read from (c) command note 3 (output) notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. when xxwr output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfcctm bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 3 xx = uu, ul, lu, ll 3. bnk.: bank address col.: column address row: row address
chapter 5 memory access control function 235 preliminar y user ? s manual u16031ej2v1ud figure 5-11. sdram access timing (9/9) (h) when written (during on-page continuous access) wr wr twr twr twr twr h t0 note 1 busclk (output) a2 to a11 (output) csn (output) sdras (output) note 3 (output) bcyst (output) we (output) d0 to d31 (i/o) sdcas (output) a12 (output) bank address (output) note 2 (output) address col. col. data t0 note 1 t0 note 1 t0 note 1 col. col. address address address address address address address address address address address address address address address address address address address address address address address wr wr data data data command notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. uudqm, uldqm, ludqm, lldqm remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address
chapter 5 memory access control function 236 preliminar y user?s manual u16031ej2v1ud 5.3.6 refresh control function the v850e/me2 can generate a refresh cycle. the refresh cycle is set with sdram refresh control registers 1, 3, 4, and 6 (rfs1, rfs3, rfs4, rfs6). rfsn corresponds to csn (n = 1, 3, 4, 6). for example, to connect sdram to cs1, set rfs1. when another bus master occupies the external bus, the dram controller cannot occupy the external bus. in this case, the dram controller issues a refresh request to the bus master by changing the refrq signal to active (low level). during a refresh operation, the address bus retains the state it was in just before the refresh cycle. (1) sdram refresh control registers 1, 3, 4, 6 (rfs1, rfs3, rfs4, rfs6) these registers are used to enable or disable a refresh and set the refresh interval. the refresh interval is determined by the following calculation formula. refresh interval ( s) = refresh count clock (t rcy ) interval factor the refresh count clock and interval factor are determined by the rccn1 and rccn0 bits and rin5n to rin0n bits, respectively, of the rfsn register. note that n corresponds to the register number (1, 3, 4, 6) of sdram configuration registers 1, 3, 4, 6 (scr1, scr3, scr4, scr6). these registers can be read or written in 16-bit units. caution write to the rfs1, rfs3, rfs4, and rfs6 registers after reset, and then do not change the set values. however, when the sdram refresh interval needs to be changed by changing the ckc register set value (internal system clock (f clk )), the set value of the rfs1, rfs3, rfs4, and rfs6 registers can be changed. for details, refer to caution 2 in 8.3.1 clock control register (ckc). also, do not access an external memory area other than the one for this initialization routine until the initial settings of the rfs1, rfs3, rfs4, and rfs6 registers are complete. however, it is possible to access external memory areas whose initialization settings are complete.
chapter 5 memory access control function 237 preliminar y user ? s manual u16031ej2v1ud 14 0 13 0 12 0 2 rin12 3 rin13 4 rin14 5 rin15 6 0 7 0 8 rcc10 9 rcc11 10 0 11 0 15 ren1 1 rin11 0 rin10 000 rin32 rin33 rin34 rin35 0 0 rcc30 rcc31 0 0 ren3 rin31 rin30 000 rin42 rin43 rin44 rin45 0 0 rcc40 rcc41 0 0 ren4 rin41 rin40 000 rin62 rin63 rin64 rin65 0 0 rcc60 rcc61 0 0 ren6 rin61 rin60 rfs1 rfs3 rfs4 rfs6 address fffff4a6h fffff4aeh fffff4b2h fffff4bah after reset 0000h 0000h 0000h 0000h bit position bit name function 15 renn specifies whether cbr refresh is enabled or disabled. 0: refresh disabled 1: refresh enabled specifies the refresh count clock (t rcy ). rccn1 rccn0 refresh count clock (t rcy ) 0 0 32/busclk 0 1 128/busclk 1 0 256/busclk 1 1 setting prohibited 9, 8 rccn1, rccn0 sets the interval factor of the interval timer for the generation of the refresh timing. rinn5 rinn4 rinn3 rinn2 rinn1 rinn0 interval factor 0000001 0000012 0000103 0000114 ::::::: 11111164 5 to 0 rinn5 to rinn0 remark n = 1, 3, 4, 6
chapter 5 memory access control function 238 preliminar y user ? s manual u16031ej2v1ud table 5-1. example of interval factor settings interval factor value notes 1, 2 specified refresh interval value ( s) refresh count clock (t rcy ) busclk = 66 mhz busclk = 50 mhz 32/busclk 32 (15.5) 24 (15.4) 128/busclk 8 (15.5) 6 (15.4) 15.6 256/busclk 4 (15.5) 3 (15.4) notes 1. the interval factor is set by bits rinn0 to rinn5 of the rfsn register (n = 1, 3, 4, 6). 2. the values in parentheses are the calculated values for the refresh interval ( s). refresh interval ( s) = refresh count clock (t rcy ) interval factor the v850e/me2 can automatically generate an auto-refresh cycle and a self-refresh cycle.
chapter 5 memory access control function 239 preliminar y user ? s manual u16031ej2v1ud (2) auto-refresh cycle in the auto-refresh cycle, the auto-refresh command (ref) is issued four clocks after the precharge command for all banks (pall) is issued. figure 5-12. auto-refresh cycle tabpw trefw trefw trefw tref sdcke (output) h h busclk (output) a2 to a11 (output) csn (output) sdras (output) note 2 (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 1 (output) h pall ref d0 to d31 (i/o) address address address auto-refresh cycle command notes 1. addresses other than the bank address, a12, and a2 to a11. 2. uudqm, uldqm, ludqm, lldqm remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6
chapter 5 memory access control function 240 preliminar y user ? s manual u16031ej2v1ud (3) refresh timing figure 5-13. cbr refresh timing (sdram) trpw trpw trpw trpw tabpw trefwtrefwtrefw tref trefw sdcke (output) all-bank precharge command trpw h h refresh command bcw 4clk trefwtrefwtrefw trpw trpw t0 note 1 t1 refresh counter match timing busclk (output) a2 to a11 (output) csn (output) sdras (output) note 3 (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 2 (output) h notes 1. state (t0) inserted between bus cycles 2. addresses other than the bank address, a12, and a2 to a11. 3. uudqm, uldqm, ludqm, lldqm remarks 1. the number of wait states set by the bcwn1 and bcwn0 bits of the scrn register 4 clocks will be inserted in the bcw 4clk period. 2. n = 1, 3, 4, 6
chapter 5 memory access control function 241 preliminar y user ? s manual u16031ej2v1ud 5.3.7 self-refresh control function in the case of transition to the idle or software stop mode, or if the selfref signal becomes active, the dram controller generates the self-refresh cycle. cautions 1. when the transition to the self-refresh cycle is caused by selfref signal input, releasing the self-refresh cycle is only possible by inputting an inactive level to the selfref pin. 2. the internal instruction ram (only in the read mode) and internal data ram can be accessed even in the self-refresh cycle. however, access to an on-chip peripheral i/o register or external device is held pending until the self-refresh cycle is cleared. to release the self-refresh cycle, use one of the three methods below. (1) release by nmi input (a) in the case of self-refresh cycle in idle mode to release the self-refresh cycle, make the sdras and sdcas signals inactive immediately. (b) in the case of self-refresh cycle in software stop mode to release the self-refresh cycle, make the sdras and sdcas signals inactive after stabilizing oscillation. (2) release by intp0n0 and intp0n1 inputs (n = 0 to 3) (a) in the case of self-refresh cycle in idle mode to release the self-refresh cycle, make the sdras and sdcas signals inactive immediately. (b) in the case of self-refresh cycle in software stop mode to release the self-refresh cycle, make the sdras and sdcas signals inactive after stabilizing oscillation. (3) release by reset input
chapter 5 memory access control function 242 preliminar y user ? s manual u16031ej2v1ud figure 5-14. self-refresh timing (sdram) trpw trpw trpw trpw tabpwtrefwtrefw trefw tref trefw trefw all-bank precharge command trpw h nop command refresh command trefwtrefw trefw trpw bcw 4clk trefw trpw trpw trpw t0 note 2 trpw nop command self-refresh mode sdcke (output) busclk (output) a2 to a11 (output) csn (output) sdras (output) note 4 (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 3 (output) h note 1 notes 1. shown above is the case when the self-refresh cycle is started in the idle or software stop mode. if the self-refresh cycle is started by inputting the active level of the selfref signal, busclk does not stop (sdcke goes low). 2. state (t0) inserted between bus cycles 3. addresses other than the bank address, a12, and a2 to a11. 4. uudqm, uldqm, ludqm, lldqm remarks 1. the number of wait states set by the bcwn1 and bcwn0 bits of the scrn register 4 clocks will be inserted in the bcw 4clk period. 2. n = 1, 3, 4, 6
chapter 5 memory access control function 243 preliminar y user ? s manual u16031ej2v1ud 5.3.8 sdram initialization sequence be sure to initialize sdram when applying power. (1) set the registers of sdram (other than sdram configuration register n (scrn)). ? bus cycle type configuration registers 0 and 1 (bct0 and bct1) ? bus cycle control register (bcc) ? sdram refresh control registers 1, 3, 4, 6 (rfs1, rfs3, rfs4, rfs6) (2) set sdram configuration registers 1, 3, 4, 6 (scr1, scr3, scr4, scr6). when writing data to these registers, the following commands are issued for sdram in the order shown below. ? all-bank precharge command ? refresh command (8 times) ? command that is used to set a mode register cautions 1. to set the scr1, scr3, scr4, and scr6 registers, confirm that the lock bit of the lock register (lockr) is set to 1, set the ckssel bit of the clock source select register (cks) to 1, and change clock supply to the cpu to sscg output (see 3.4.10 initialization sequence). 2. if it is necessary to make the input levels of the uudqm, uldqm, ludqm, and lldqm pins high until initialization of sdram is completed, do not change the set values of the pfcct3 to pfcct0 bits of the pfcct register and do not write the external device until initialization of sdram is completed. figures 5-15 and 5-16 show examples of the sdram mode register setting timing.
chapter 5 memory access control function 244 preliminar y user ? s manual u16031ej2v1ud figure 5-15. sdram mode register setting cycle h tabpw trefw trefw trefw tref trefw tregw refresh command (ref) generated 8 times sdcke (output) busclk (output) a2 to a11 (output) csn (output) sdras (output) note 2 (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 1 (output) h h valid d0 to d31 (i/o) pall ref regwr mode register setting cycle command notes 1. addresses other than the bank address, a12, and a2 to a11. 2. uudqm, uldqm, ludqm, lldqm
chapter 5 memory access control function 245 preliminar y user ? s manual u16031ej2v1ud figure 5-16. sdram register write operation timing tw0 tw0 tw0 h tw0 tw0 tabpwtrefwtrefwtrefw tref trefwtrefwtrefw trefw tref trefw trefwtrefwtregw trpw trpw trpw trpw trpw refresh end (1st time) refresh command (2nd time) refresh 7 register write command sdram access enable refresh end (8th time) refresh interval 1/2 tw0 tw0 tw0 refresh command (1st time) scrn register write all-bank precharge command valid sdcke (output) busclk (output) a2 to a11 (output) csn (output) sdras (output) note 2 (output) bcyst (output) we (output) sdcas (output) a12 (output) bank address (output) note 1 (output) h notes 1. addresses other than the bank address, a12, and a2 to a11. 2. uudqm, uldqm, ludqm, lldqm remark n = 1, 3, 4, 6
246 preliminar y user?s manual u16031ej2v1ud chapter 6 dma functions (dma controller) the v850e/me2 includes a direct memory access (dma) controller (dmac) that executes and controls dma transfer. the dmac controls data transfer between memory and i/o, or among memories, based on requests by interrupts from on-chip peripheral i/o (serial interface, real-time pulse unit, and a/d converter) or dma requests issued by the dmarq0 to dmarq3 pins, software triggers, or usb. memory refers to the internal instruction ram, internal data ram, or external memory. however, the internal instruction ram can be used only as the transfer destination. 6.1 features  4 independent dma channels  transfer unit: 8/16/32 bits  maximum transfer count: 65,536 (2 16 )  two types of transfer  flyby (1-cycle) transfer  2-cycle transfer  three transfer modes  single transfer mode  single-step transfer mode  block transfer mode  transfer requests  request by interrupts from on-chip peripheral i/o (serial interface, real-time pulse unit, a/d converter)  requests via dmarq0 to dmarq3 pin input  requests by software trigger  requests by usb (only in the single transfer mode)  transfer objects  memory ? i/o  memory ? memory  dma transfer end output signals (tc0 to tc3)  next address setting function
chapter 6 dma functions (dma controller) 247 preliminar y user?s manual u16031ej2v1ud 6.2 configuration tcn cpu internal data ram on-chip peripheral io on-chip peripheral i/o bus internal bus data control address control count control channel control dmac v850e/me2 bus interface external bus external ram external rom external i/o dma source address register (dsanh/dsanl) dma transfer count register (dbcn) dma channel control register (dchcn) dma terminal count output control register (dtoc) dma destination address register (ddanh/ddanl) dmarqn dmaakn dma addressing control register (dadcn) dma interface control register (difc) dma trigger factor register (dtfrn) internal instruction ram remark n = 0 to 3
chapter 6 dma functions (dma controller) 248 preliminar y user ? s manual u16031ej2v1ud 6.3 control registers 6.3.1 dma source address registers 0 to 3 (dsa0 to dsa3) these registers are used to set the dma transfer source address (28 bits) for dma channel n (n = 0 to 3). they are divided into two 16-bit registers, dsanh and dsanl. since these registers are configured as 2-stage fifo buffer registers, a new transfer source address for dma transfer can be specified during dma transfer (see 6.8 next address setting function ). in this case, the newly set value of the dsan register is transferred to the slave register and becomes valid only when dma transfer has been completed normally and the tcn bit of the dchcn register is set to 1, or when the initn bit of the dchcn register is set to 1 (n = 0 to 3). however, the set value of the dsan register is invalid even when the enn bit of the dchcn register is cleared to 0 to disable dma transfer and then the dsan register is set. when flyby transfer is specified with the ttypn bit of dma addressing control register n (dadcn), the external memory addresses are set by the dsan register. at this time, the setting of dma destination address register n (ddan) is ignored (n = 0 to 3). (1) dma source address registers 0h to 3h (dsa0h to dsa3h) these registers can be read or written in 16-bit units. be sure to clear bits 14 to 12 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. when setting an address of a peripheral i/o register for the source address, be sure to specify an address between ffff000h and fffffffh. an address of the peripheral i/o register image (3fff000h to 3ffffffh) must not be specified. 2. do not set the dsanh register while dma transfer is suspended. dsa0h dsa1h dsa2h dsa3h 15 irs0 irs1 irs2 irs3 14 0 0 0 0 13 0 0 0 0 12 0 0 0 0 11 sa027 sa127 sa227 sa327 10 sa026 sa126 sa226 sa326 9 sa025 sa125 sa225 sa325 8 sa024 sa124 sa224 sa324 7 sa023 sa123 sa223 sa323 6 sa022 sa122 sa222 sa322 5 sa021 sa121 sa221 sa321 4 sa020 sa120 sa220 sa320 3 sa019 sa119 sa219 sa319 2 sa018 sa118 sa218 sa318 1 sa017 sa117 sa217 sa317 0 sa016 sa116 sa216 sa316 address fffff082h fffff08ah fffff092h fffff09ah after reset undefined undefined undefined undefined bit position bit name function 15 irsn specifies the dma transfer source address. 0: external memory, on-chip peripheral i/o 1: internal data ram 11 to 0 san27 to san16 sets the dma transfer source address (a27 to a16). during dma transfer, it stores the next dma transfer source address. during flyby transfer, it stores an external memory address. remark n = 0 to 3
chapter 6 dma functions (dma controller) 249 preliminar y user ? s manual u16031ej2v1ud (2) dma source address registers 0l to 3l (dsa0l to dsa3l) these registers can be read or written in 16-bit units. dsa0l dsa1l dsa2l dsa3l 15 sa015 sa115 sa215 sa315 14 sa014 sa114 sa214 sa314 13 sa013 sa113 sa213 sa313 12 sa012 sa112 sa212 sa312 11 sa011 sa111 sa211 sa311 10 sa010 sa110 sa210 sa310 9 sa09 sa19 sa29 sa39 8 sa08 sa18 sa28 sa38 7 sa07 sa17 sa27 sa37 6 sa06 sa16 sa26 sa36 5 sa05 sa15 sa25 sa35 4 sa04 sa14 sa24 sa34 3 sa03 sa13 sa23 sa33 2 sa02 sa12 sa22 sa32 1 sa01 sa11 sa21 sa31 0 sa00 sa10 sa20 sa30 address fffff080h fffff088h fffff090h fffff098h after reset undefined undefined undefined undefined bit position bit name function 15 to 0 san15 to san0 sets the dma transfer source address (a15 to a0). during dma transfer, it stores the next dma transfer source address. during flyby transfer, it stores an external memory address. remark n = 0 to 3
chapter 6 dma functions (dma controller) 250 preliminar y user?s manual u16031ej2v1ud 6.3.2 dma destination address registers 0 to 3 (dda0 to dda3) these registers are used to set the dma transfer destination address (28 bits) for dma channel n (n = 0 to 3). they are divided into two 16-bit registers, ddanh and ddanl. since these registers are configured as 2-stage fifo buffer registers, a new transfer destination address for dma transfer can be specified during dma transfer (see 6.8 next address setting function ). in this case, the newly set value of the ddan register is transferred to the slave register and becomes valid only when dma transfer has been completed normally and the tcn bit of the dchcn register is set to 1, or when the initn bit of the dchcn register is set to 1 (n = 0 to 3). however, the set value of the ddan register is invalid even when the enn bit of the dchcn register is cleared to 0 to disable dma transfer and then the ddan register is set. when flyby transfer is specified with the ttypn bit of dma addressing control register n (dadcn), the setting of dma destination address register n (ddan) is ignored. (1) dma destination address registers 0h to 3h (dda0h to dda3h) these registers can be read or written in 16-bit units. be sure to clear bits 14 to 12 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. when setting an address of a peripheral i/o register for the destination address, be sure to specify an address between ffff000h and fffffffh. an address of the peripheral i/o register image (3fff000h to 3ffffffh) must not be specified. 2. do not set the ddanh register while dma transfer is suspended. dda0h dda1h dda2h dda3h 15 ird0 ird1 ird2 ird3 14 0 0 0 0 13 0 0 0 0 12 0 0 0 0 11 da027 da127 da227 da327 10 da026 da126 da226 da326 9 da025 da125 da225 da325 8 da024 da124 da224 da324 7 da023 da123 da223 da323 6 da022 da122 da222 da322 5 da021 da121 da221 da321 4 da020 da120 da220 da320 3 da019 da119 da219 da319 2 da018 da118 da218 da318 1 da017 da117 da217 da317 0 da016 da116 da216 da316 address fffff086h fffff08eh fffff096h fffff09eh after reset undefined undefined undefined undefined bit position bit name function 15 irdn specifies the dma transfer destination address. 0: external memory, on-chip peripheral i/o, internal instruction ram 1: internal data ram 11 to 0 dan27 to dan16 sets the dma transfer destination address (a27 to a16). during dma transfer, it stores the next dma transfer destination address. this setting is ignored during flyby transfer. remark n = 0 to 3
chapter 6 dma functions (dma controller) 251 preliminar y user ? s manual u16031ej2v1ud (2) dma destination address registers 0l to 3l (dda0l to dda3l) these registers can be read or written in 16-bit units. dda0l dda1l dda2l dda3l 15 da015 da115 da215 da315 14 da014 da114 da214 da314 13 da013 da113 da213 da313 12 da012 da112 da212 da312 11 da011 da111 da211 da311 10 da010 da110 da210 da310 9 da09 da19 da29 da39 8 da08 da18 da28 da38 7 da07 da17 da27 da37 6 da06 da16 da26 da36 5 da05 da15 da25 da35 4 da04 da14 da24 da34 3 da03 da13 da23 da33 2 da02 da12 da22 da32 1 da01 da11 da21 da31 0 da00 da10 da20 da30 address fffff084h fffff08ch fffff094h fffff09ch after reset undefined undefined undefined undefined bit position bit name function 15 to 0 dan15 to dan0 sets the dma transfer destination address (a15 to a0). during dma transfer, it stores the next dma transfer destination address. this setting is ignored during flyby transfer. remark n = 0 to 3
chapter 6 dma functions (dma controller) 252 preliminar y user?s manual u16031ej2v1ud 6.3.3 dma transfer count registers 0 to 3 (dbc0 to dbc3) these 16-bit registers are used to set the byte transfer count for dma channel n (n = 0 to 3). they store the remaining transfer count during dma transfer. since these registers are configured as 2-stage fifo buffer registers, a new dma byte transfer count for dma transfer can be specified during dma transfer (see 6.8 next address setting function ). in this case, the newly set value of the dbcn register is transferred to the slave register and becomes valid only when dma transfer has been completed normally and the tcn bit of the dchcn register is set to 1, or when the initn bit of the dchcn register is set to 1 (n = 0 to 3). however, the set value of the dbcn register is invalid even when the enn bit of the dchcn register is cleared to 0 to disable dma transfer and then the dbcn register is set. these registers are decremented by 1 for each transfer, and transfer ends when a borrow occurs. these registers can be read or written in 16-bit units. cautions 1. if the dbcn register is read during dma transfer after a terminal count has occurred without the register being overwritten, the value set immediately before the dma transfer will be read out (0000h will not be read, even if dma transfer has ended). 2. do not set the dbcn register while dma transfer is suspended. dbc0 dbc1 dbc2 dbc3 15 bc015 bc115 bc215 bc315 14 bc014 bc114 bc214 bc314 13 bc013 bc113 bc213 bc313 12 bc012 bc112 bc212 bc312 11 bc011 bc111 bc211 bc311 10 bc010 bc110 bc210 bc310 9 bc09 bc19 bc29 bc39 8 bc08 bc18 bc28 bc38 7 bc07 bc17 bc27 bc37 6 bc06 bc16 bc26 bc36 5 bc05 bc15 bc25 bc35 4 bc04 bc14 bc24 bc34 3 bc03 bc13 bc23 bc33 2 bc02 bc12 bc22 bc32 1 bc01 bc11 bc21 bc31 0 bc00 bc10 bc20 bc30 address fffff0c0h fffff0c2h fffff0c4h fffff0c6h after reset undefined undefined undefined undefined bit position bit name function sets the byte transfer count and stores the remaining byte transfer count during dma transfer. dbcn states 0000h byte transfer count 1 or remaining byte transfer count 0001h byte transfer count 2 or remaining byte transfer count :: ffffh byte transfer count 65,536 (2 16 ) or remaining byte transfer count 15 to 0 bcn15 to bcn0 remark n = 0 to 3
chapter 6 dma functions (dma controller) 253 preliminar y user ? s manual u16031ej2v1ud 6.3.4 dma addressing control registers 0 to 3 (dadc0 to dadc3) these 16-bit registers are used to control the dma transfer mode for dma channel n (n = 0 to 3). these registers cannot be accessed during dma operation. these registers can be read or written in 16-bit units. be sure to clear bits 13 to 8 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. the dsn1 and dsn0 bits set how many bits of data are to be transferred. when 8-bit data is set (dsn1 and dsn0 bits = 00), the lower bytes of the data bus (d0 to d7) are not always used. if the transfer data size is set to 16 bits, transfer is always started from an address with the lowest bit of the address aligned to ?0?. if the data size is set to 32 bits, transfer is started from an address with the lowest 2 bits of the address aligned to ?0?. in this case, transfer cannot be started from an odd address. 2. set the dadcn register at the following timing while the target dma channel is in operation or is not suspended (the operation is not guaranteed if the register is set at any other timing). ? ? ? ? period from system reset to generation of the first dma transfer request ? ? ? ? period from completion of dma transfer (after generation of terminal count) to generation of the next dma transfer request ? ? ? ? period from forced termination of dma transfer (after the initn bit of the dchcn register is set to 1) to generation of the next dma transfer request 3. do not set flyby transfer via the ttypn bit if all the following conditions are satisfied (n = 0 to 3). ? ? ? ? bmc register = 00h ? ? ? ? fwn2 to fwn0 bits of fwc register = 000 ? ? ? ? fin1 to fin0 bits of fic register = 00 ? ? ? ? acn1 and acn0 bits of the csn space subject to flyby transfer by the asc register = 00 (during transfer to/from sram)
chapter 6 dma functions (dma controller) 254 preliminar y user ? s manual u16031ej2v1ud (1/2) dadc0 dadc1 dadc2 dadc3 15 ds01 ds11 ds21 ds31 14 ds00 ds10 ds20 ds30 13 0 0 0 0 12 0 0 0 0 11 0 0 0 0 10 0 0 0 0 9 0 0 0 0 8 0 0 0 0 7 sad01 sad11 sad21 sad31 6 sad00 sad10 sad20 sad30 5 dad01 dad11 dad21 dad31 4 dad00 dad10 dad20 dad30 3 tm01 tm11 tm21 tm31 2 tm00 tm10 tm20 tm30 1 ttyp0 ttyp1 ttyp2 ttyp3 0 tdir0 tdir1 tdir2 tdir3 address fffff0d0h fffff0d2h fffff0d4h fffff0d6h after reset 0000h 0000h 0000h 0000h bit position bit name function sets the transfer data size for dma transfer. dsn1 dsn0 transfer data size 0 0 8 bits 0 1 16 bits 1 0 32 bits 1 1 setting prohibited 15, 14 dsn1, dsn0 sets the count direction of the source address for dma channel n. sadn1 sadn0 count direction 0 0 increment 0 1 decrement 10fixed 1 1 setting prohibited 7, 6 sadn1, sadn0 remark n = 0 to 3
chapter 6 dma functions (dma controller) 255 preliminar y user ? s manual u16031ej2v1ud (2/2) bit position bit name function sets the count direction of the destination address for dma channel n. dadn1 dadn0 count direction 0 0 increment 0 1 decrement 10fixed 1 1 setting prohibited 5, 4 dadn1, dadn0 sets the transfer mode during dma transfer. tmn1 tmn0 transfer mode 0 0 single transfer mode 0 1 single-step transfer mode 1 0 setting prohibited 1 1 block transfer mode 3, 2 tmn1, tmn0 1 ttypn sets the dma transfer type. 0: 2-cycle transfer 1: flyby transfer 0 tdirn sets the transfer direction during transfer between i/o and memory. the setting is valid during flyby transfer only and ignored during 2-cycle transfer. 0: memory i/o (read) 1: i/o memory (write) remark n = 0 to 3
chapter 6 dma functions (dma controller) 256 preliminar y user?s manual u16031ej2v1ud 6.3.5 dma channel control registers 0 to 3 (dchc0 to dchc3) these 8-bit registers are used to control the dma transfer operating mode for dma channel n (n = 0 to 3). these registers can be read or written in 8-bit or 1-bit units. (however, bit 7 is read only and bits 2 and 1 are write only. if bits 2 and 1 are read, the read value is always 0.) be sure to clear bits 6 to 4 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. during a 2-cycle transfer that performs a write operation on the external device, the write operation on the external device may not be completed even if the tcn bit of the dchcn register is set to 1 (dma transfer completion) by the write buffer function. recognize completion of the write operation on the external device as follows, if necessary. ? ? ? ? monitor the signal of the tcn pin (the tcn pin becomes active in synchronization with the write operation on the external device). ? ? ? ? after it has been detected that the tcn bit of the dchcn register is set to 1, write the same value as that set to the lbc0 or lbc1 register. when this dummy write is completed, completion of an access from the write buffer to the external device can be recognized. if the set value of the lbc0 or lbc1 register is rewritten when a dummy write is executed, the operation is not guaranteed. 2. setting the mlen bit to 1 is valid only when dma transfer (hardware dma) is started by dmarqn pin input or an interrupt from the on-chip peripheral i/o. to start dma transfer by setting the stgn bit to 1 (software dma), read the tcn bit and confirm that it is set to 1, and then set the stgn bit to 1. 3. set the mlen bit at the following timing while the target dma channel is in operation or is not suspended (the operation is not guaranteed if the register is set at any other timing). ? ? ? ? period from system reset to generation of the first dma transfer request ? ? ? ? period from completion of dma transfer (after generation of terminal count) to generation of the next dma transfer request ? ? ? ? period from forced termination of dma transfer (after the initn bit is set to 1) to generation of the next dma transfer request 4. if dma transfer is forcibly terminated in the last transfer cycle with the mlen bit set to 1, the same operation as that performed when transfer is completed is performed (the tcn bit is set to 1). (the enn bit is cleared to 0 on completion of forced termination, regardless of the value of the mlen bit.) in this case, the tcn bit must be read (cleared to 0) in addition to setting the enn bit when the next dma transfer is requested. 5. do not set the enn and stgn bits while dma is suspended. 6. each bit is updated upon completion of dma transfer (at terminal count) with the enn bit cleared to 0 and the tcn bit set to 1 in that order. while the statuses of the tcn and enn bits are being polled, therefore, values indicating the status of ?transfer not completed and prohibited? (tcn bit = 0 and enn bit = 0) may be read if the dchcn register is read while each bit is being updated.
chapter 6 dma functions (dma controller) 257 preliminar y user ? s manual u16031ej2v1ud cautions 7. the tcn bit does not have to be read (cleared to 0) on completion of dma transfer (on generation of the terminal count) only if the following two conditions are satisfied. if either of the conditions is not satisfied, be sure to read the tcn bit (cleared to 0) before the next dma transfer request is generated. ? ? ? ? if the mlen bit is set to 1 upon completion of dma transfer (at terminal count) ? ? ? ? if the source that starts the next dma transfer is an external pin (dmarqn) if these two conditions are not satisfied, the operation is not guaranteed if the next dma transfer request is generated with the tcn bit set to 1.
chapter 6 dma functions (dma controller) 258 preliminar y user?s manual u16031ej2v1ud tc0 tc1 tc2 tc3 dchc0 dchc1 dchc2 dchc3 6 0 0 0 0 5 0 0 0 0 4 0 0 0 0 mle0 mle1 mle2 mle3 init0 init1 init2 init3 stg0 stg1 stg2 stg3 e00 e11 e22 e33 address fffff0e0h fffff0e2h fffff0e4h fffff0e6h after reset 00h 00h 00h 00h <7> <1> <2> <3> <0> bit position bit name function 7 tcn this status bit indicates whether dma transfer through dma channel n is complete or not. this bit is read-only. it is set to 1 during the last dma transfer and cleared to 0 when it is read. 0: dma transfer is not complete. 1: dma transfer is complete. caution to read the tcn bit on completion of a dma transfer that transfers data to/from the internal data ram, first read the status in which the tcn bit was set to 1, and then insert two dummy reads of the dchcn register in a row. 3 mlen if this bit is set to 1 when dma transfer is complete (at terminal count output), the enn bit is not cleared to 0 and the dma transfer enable state is retained. if the next dma transfer startup factor is input from the dmarqn pin or is an interrupt from the on-chip peripheral i/o (hardware dma), the dma transfer request is acknowledged even if the tcn bit is not read. if the next dma transfer startup factor is input by setting the stgn bit to 1 (software dma), the dma transfer request is acknowledged if the tcn bit is read and cleared to 0. if this bit is cleared to 0 when dma transfer is complete (at terminal count output), the enn bit is cleared to 0 and the dma transfer disable state is entered. at the next dma request, the enn bit must be set to 1 and the tcn bit read. 2 initn if this bit is set to 1 during dma transfer or while dma transfer is suspended, dma transfer is forcibly terminated. 1 stgn if this bit is set to 1 in the dma transfer enable state (tcn bit = 0, enn bit = 1), dma transfer is started. 0 enn specifies whether dma transfer through dma channel n is to be enabled or disabled. this bit is cleared to 0 when dma transfer ends. it is also cleared to 0 when dma transfer is forcibly interrupted or forcibly terminated by setting the initn bit to 1 or by nmi input. 0: dma transfer disabled 1: dma transfer enabled cautions 1. do not terminate a dma transfer in progress by clearing the enn bit to 0. 2. if the enn bit is set to 1, do not set the enn bit until dma transfer is completed the number of times specified by the dbcn register or until dma transfer is forcibly terminated by using the initn bit. remark n = 0 to 3
chapter 6 dma functions (dma controller) 259 preliminar y user?s manual u16031ej2v1ud 6.3.6 dma terminal count output control register (dtoc) the dma terminal count output control register (dtoc) is an 8-bit register that controls the terminal count output from each dma channel and dma transfer during nmi input. terminal count signals from each dma channel can be brought together and output from the tc0 pin. this register can be read or written in 8-bit or 1-bit units. dtoc 7 dmstpm 6 dakebc 5 0 4 0 <3> tco3 <2> tco2 <1> tco1 <0> tco0 address fffff8a0h after reset 01h bit position bit name function 7 dmstpm controls dma transfer when nmi is input. 0: forcibly aborts dma transfer when nmi is input. 1: does not abort dma transfer when nmi is input. cautions 1. when dmstpm bit = 0, nmi servicing can be executed immediately after completion of the dma cycle currently under execution. before executing the aborted dma transfer, however, be sure to re-initialize it. 2. when dmstpm bit = 1, nmi servicing is held pending in the block transfer mode until dma transfer has been completed the preset number of times. in the single transfer mode and single-step transfer mode, nmi servicing is executed after the dma cycle currently under execution is completed. as necessary, forcibly terminate dma transfer by setting the initn bit of the dchcn register to 1 (n = 0 to 3). 3. be sure to change the value of the dmstpm bit when dma is not used. the operation is not guaranteed if the value of the dmstpm bit is changed after registers related to dmac have been set or during dma transfer. 6 dakebc specifies extension of the active width of the dmaakn signal while the daken bit of the difc register = 1. 0: active width extended by four internal system clocks. 1: active width extended by six to seven internal system clocks. remark for details of the function to extend the active width of the dmaakn signal, refer to 6.3.8 dma interface control register (difc) or 6.5.1 (2) dmaakn signal active width extension function . 3 to 0 tco3 to tco0 indicates the state of the tc0 pin. 0: channel n terminal count signal not output from tc0 pin. 1: channel n terminal count signal output from tc0 pin.
chapter 6 dma functions (dma controller) 260 preliminar y user ? s manual u16031ej2v1ud the following shows an example of the case when the dtoc register is set to 03h. tc0 (output) tc2 (output) dma0 cpu dma0 dma1 dma1 cpu dma2 dma2 dma channel 2 terminal count dma channel 1 terminal count dma channel 0 terminal count 6.3.7 dma trigger factor registers 0 to 3 (dtfr0 to dtfr3) these 8-bit registers are used to control the dma transfer start trigger through interrupt requests from on-chip peripheral i/o. the interrupt requests set by these registers serve as dma transfer startup factors. these registers can be read or written in 8-bit or 1-bit units. however, only bit 7 (dfn) can be read or written in 1- bit units. cautions 1. to change the setting of the dtfrn register, be sure to stop the dma operation. 2. an interrupt request input in the standby mode (idle or software stop mode) cannot be a dma transfer start factor. 3. if the factor of starting dma transfer is changed by using the ifcn6 to ifcn0 bits, be sure to clear the dfn bit to 0 using the instruction immediately after. 4. when a transmission completion interrupt request signal (ubtit0 or ubtit1) of uartb is used as the factor of starting dma transfer, the factor of starting dma transfer that is triggered by the interrupt request signal generated when the last transmission was completed is retained. in this case, clear the dfn bit to 0 to clear the dma transfer request.
chapter 6 dma functions (dma controller) 261 preliminar y user ? s manual u16031ej2v1ud (1/3) df0 df1 df2 df3 dtfr0 dtfr1 dtfr2 dtfr3 6 ifc06 ifc16 ifc26 ifc36 5 ifc05 ifc15 ifc25 ifc35 4 ifc04 ifc14 ifc24 ifc34 3 ifc03 ifc13 ifc23 ifc33 2 ifc02 ifc12 ifc22 ifc32 1 ifc01 ifc11 ifc21 ifc31 0 ifc00 ifc10 ifc20 ifc30 address fffff810h fffff812h fffff814h fffff816h after reset 00h 00h 00h 00h <7> bit position bit name function 7 dfn this is a dma transfer request flag. only 0 can be written to this flag. 0: dma transfer not requested 1: dma transfer requested if the interrupt specified as the dma transfer startup trigger occurs and it is necessary to clear the dma transfer request while dma transfer is disabled (including when it is aborted by nmi or forcibly terminated by software), stop the operation of the source causing the interrupt, and then clear the dfn bit to 0 (for example, disable reception in the case of serial reception). if it is clear that the interrupt will not occur until dma transfer is resumed next, it is not necessary to stop the operation of the source causing the interrupt. this code is used to set the interrupt sources serving as dma transfer startup factors. ifcn6 ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 interrupt source 0 0 0 0 0 0 0 level detection mode of dmarqn pin input (dma request from on- chip peripheral i/o disabled) 0000001 edge detection mode of dmarqn pin input (dma request from on- chip peripheral i/o disabled) 0000010intp10 0000011intp11 0000100intp21 0000101intp22 0000110intp23 0000111intp24 0001000intp25 6 to 0 ifcn6 to ifcn0 remark n = 0 to 3
chapter 6 dma functions (dma controller) 262 preliminar y user ? s manual u16031ej2v1ud (2/3) bit position bit name function ifcn6 ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 interrupt source 0001001intp50 0001010intp51 0001011intp52 0001100intp65 0001101intp66 0001110intp67 0001111intpd0 0010000intpd1 0010001intpd2 0010010intpd3 0010011intpd4 0010100intpd5 0010101intpd6 0010110intpd7 0010111intpd8 0011000intpd9 0011001intpd10 0011010intpd11 0011011intpd12 0011100intpd13 0011101intpd14 0011110intpd15 0011111intpl0 0100000intpl1 0 1 0 0 0 0 1 intpc00/intccc00 0 1 0 0 0 1 0 intpc01/intccc01 0 1 0 0 0 1 1 intpc10/intccc10 0 1 0 0 1 0 0 intpc11/intccc11 0 1 0 0 1 0 1 intpc20/intccc20 0 1 0 0 1 1 0 intpc21/intccc21 0 1 0 0 1 1 1 intpc30/intccc30 0 1 0 1 0 0 0 intpc31/intccc31 6 to 0 ifcn6 to ifcn0 remark n = 0 to 3
chapter 6 dma functions (dma controller) 263 preliminar y user ? s manual u16031ej2v1ud (3/3) bit position bit name function ifcn6 ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 interrupt source 0 1 0 1 0 0 1 intccc40 0 1 0 1 0 1 0 intccc41 0 1 0 1 0 1 1 intccc50 0 1 0 1 1 0 0 intccc51 0101101intcmd0 0101110intcmd1 0101111intcmd2 0110000intcmd3 0110001intcc100 0110010intcc101 0110011intcm100 0110100intcm101 0110101intcc110 0110110intcc111 0110111intcm110 0111000intcm111 0111001intcsi30 0111010intcsi31 0111011ubtir0 0111100ubtit0 0111101ubtir1 0111110ubtit1 0111111intad 1 1 1 1 1 1 1 ufdrqn other than above setting prohibited 6 to 0 ifcn6 to ifcn0 caution when using an external interrupt (when ifcn6 to ifcn0 bits = 0000010b to 0100000b) as a dma trigger source, be sure to specify an edge (do not use level detection). remark n = 0 to 3
chapter 6 dma functions (dma controller) 264 preliminar y user?s manual u16031ej2v1ud the relationship between the dmarqn signal and the interrupt source that serves as a dma transfer trigger is as follows (n = 0 to 3). ifcn0 to ifcn6 internal dma request signal interrupt source dmarqn selector remark if an interrupt request is specified as the dma transfer start factor, an interrupt request will be generated if dma transfer starts. to prevent an interrupt from being generated, mask the interrupt by setting the interrupt request control register. dma transfer starts even if an interrupt is masked. for the level detection mode (ifcn6 to ifcn0 bits = 0000000) and edge detection mode (ifcn6 to ifcn0 bits = 0000001) of the dmarqn pin input, see figures 6-8 to 6-10 (n = 0 to 3). (1) dma request detection function the v850e/me2 has a level detection mode and an edge detection mode as functions to sample the dmarqn pin (n = 0 to 3). the level detection mode also has a mask mode in which sampling the dma request is masked. (a) level detection mode (ifcn6 to ifcn0 bits = 0000000) in this mode, handshaking of the dmarqn and dmaakn signals can be executed at high speeds. in the single transfer mode, deassert the dmarqn signal for the duration of twice the internal system clock from the rising edge of the dmaakn signal, in order not to start the dma transfer cycle next to that currently under execution. if the dmarqn signal is active for the duration of twice the internal system clock, the next dma request is recognized. in the 2-cycle transfer mode, however, the active period of the dmaakn signal may be shortened depending on the combination of the transfer source and transfer destination (min.: 2 internal system clock). consequently, if the inactive timing of the dmarqn signal is generated from the falling edge of the dmaakn signal, for example, the timing may be four times the internal system clock at the shortest. for the active width of the dmaakn signal for 2-cycle transfer, refer to table 6-4 minimum value of active width of dmaakn signal for 2-cycle transfer . <1> mask mode (ifcn6 to ifcn0 bits = 0000000 and drmkn bit of difc register = 1) this mode is used to establish handshaking of the dmarqn and dmaakn signals in synchronization with busclk in the level detection mode. in the single transfer mode, deassert the dmarqn signal within 3 busclk after sampling the rising edge of the dmaakn signal, in order not to start the dma transfer cycle next to that currently under execution. when the mask mode is set, sampling the dma request is always masked for the duration of 3 busclk period from the rising edge of the dmarqn signal, regardless of the division ratio of busclk (set by the bmc register).
chapter 6 dma functions (dma controller) 265 preliminar y user ? s manual u16031ej2v1ud (b) edge detection mode (ifcn6 to ifcn0 bits = 0000001) this mode uses the falling edge of the dmarqn signal as a dma request. it realizes handshaking of the dmarqn and dmaakn signals at a speed much lower than that when the mask mode is used. however, note that the falling edge of the dmarqn signal is ignored, even if input, while the dmaakn signal is active. for the detailed timing in each mode, refer to chapter 17 electrical specifications (target values) .
chapter 6 dma functions (dma controller) 266 preliminar y user?s manual u16031ej2v1ud 6.3.8 dma interface control register (difc) this 8-bit register controls the active width of the dmaakn signal of each dma channel and controls the mask function (dma mask mode) of the dmarqn signal (n = 0 to 3). this register can be read or written in 8-bit or 1-bit units. dake3 6 dake2 5 dake1 4 dake0 3 drmk3 2 drmk2 1 drmk1 0 drmk0 address fffff8a8h after reset 00h 7 difc bit position bit name function 7 to 4 daken these bits specify the active width of the dmaakn signal. 0: active width of dmaakn signal output from dmac 1: active width of dmaakn signal + active extension width note output from dmac note the active width is extended by the daken bit as follows. ? four internal system clocks when dakebc bit of dtoc register = 0 ? six to seven internal system clocks when dakebc bit of dtoc register = 1 for details of the function to extend the active width of the dmaakn signal, refer to 6.3.8 dma interface control register (difc) or 6.5.1 (2) dmaakn signal active width extension function . cautions 1. do not set the daken bits to 1 during flyby transfer. 2. if either of the following conditions is satisfied when the function to extend the active width of the dmaakn signal is used, the next dmaakn signal is asserted while the active width of the preceding dmaakn signal is extended. as a result, the active cycles of more than one dmaakn signal combine into one dmaakn signal, and the number of times the dmaakn signal is asserted is less than the actual number of dma cycles. ? ? ? ? during block transfer or single-step transfer ? ? ? ? when the dmarqn signal is kept active (including when the next dma request is generated while the dmaakn signal is active or immediately after it has been deasserted in the pending mode of uartb) 3 to 0 drmkn these are mask bits of the dmarqn signal. they specify the dma mask mode. 0: do not mask the dmarqn signal. 1: mask input of the dmarqn signal for the duration of 3 bus clocks from the rising edge of the dmaakn signal. caution the period masked by the drmkn bit is three bus clocks (busclk) from the rising edge of the dmaakn signal. if the rising edge of the dmaakn signal is sampled with drmkn bit = 1, the dma controller does not recognize the next dma transfer request if the dmarqn signal is deasserted within 3 bus clocks (busclk) after the rising edge (high level) of the dmaakn signal has been sampled with busclk. remark n = 0 to 3
chapter 6 dma functions (dma controller) 267 preliminar y user ? s manual u16031ej2v1ud 6.4 transfer modes 6.4.1 single transfer mode in single transfer mode, the dmac releases the bus at each byte/halfword/word transfer. if there is a subsequent dma transfer request, transfer is performed again once. this operation continues until a terminal count occurs. when the dmac has released the bus, if another higher priority dma transfer request is issued, the higher priority dma request always takes precedence. if other dma transfer request with the lower priority occurs one clock after single transfer has been completed, however, this request does not take precedence even if the previous dma transfer request signal with the higher priority remains active. dma transfer with the lower priority newly request is executed after the cpu bus has been released. figures 6-1 to 6-4 show examples of single transfer. figure 6-1. single transfer example 1 cpu dmarq3 (input) cpu dma3 cpu dma3 cpu dma3 cpu cpu cpu cpu cpu cpu dma3 cpu dma3 cpu cpu cpu dma channel 3 terminal count note note note note note the bus is always released. figure 6-2 shows an example of a single transfer in which a higher priority dma request is issued. dma channels 0 to 2 are in the block transfer mode and channel 3 is in the single transfer mode. figure 6-2. single transfer example 2 cpu cpu cpu dma3 cpu dma0 dma0 cpu dma1 dma1 cpu dma2 dma2 cpu dma3 cpu dma3 dmarq3 (input) dmarq2 (input) dmarq1 (input) dmarq0 (input) dma channel 3 terminal count dma channel 0 terminal count dma channel 2 terminal count note note note note dma channel 1 terminal count note the bus is always released.
chapter 6 dma functions (dma controller) 268 preliminar y user ? s manual u16031ej2v1ud figure 6-3 is an example of single transfer where a dma transfer request with the lower priority is issued one clock after single transfer has been completed. dma channels 0 and 3 are used for single transfer. if two dma transfer request signals become active at the same time, two dma transfer operations are alternately executed. figure 6-3. single transfer example 3 cpu cpu cpu dma0 dma0 cpu dma0 cpu dma0 cpu dma0 cpu cpu cpu dma0 cpu dma3 cpu dma3 dma channel 3 terminal count dma channel 0 terminal count dmarq3 (input) dmarq0 (input) note note note note note note note note the bus is always released. figure 6-4 is an example of single transfer where two or more dma transfer requests with the lower priority are issued one clock after single transfer has been completed. dma channels 0, 2, and 3 are used for single transfer. if three or more dma transfer request signals become active at the same time, two dma transfer operations are alternately executed, always starting from the one with the highest priority. figure 6-4. single transfer example 4 cpu dma3 cpu dma3 cpu dma2 cpu dma2 cpu dma2 cpu dma2 cpu dma3 cpu cpu cpu dma3 cpu dma0 cpu dma0 dma channel 0 terminal count dma channel 2 terminal count dma channel 3 terminal count dmarq2 (input) dmarq3 (input) dmarq0 (input) note note note note note note note note note note the bus is always released.
chapter 6 dma functions (dma controller) 269 preliminar y user ? s manual u16031ej2v1ud 6.4.2 single-step transfer mode in single-step transfer mode, the dmac releases the bus at each byte/halfword/word transfer. if there is a subsequent dma transfer request signal (dmarq0 to dmarq3), transfer is performed again. this operation continues until a terminal count occurs. when the dmac has released the bus, if another higher priority dma transfer request is issued, the higher priority dma request always takes precedence. the following shows an example of a single-step transfer. figure 6-6 shows an example of single-step transfer made in which a higher priority dma request is issued. dma channels 0 and 1 are in the single-step transfer mode. figure 6-5. single-step transfer example 1 cpu cpu cpu dma1 cpu dma1 cpu dma1 cpu dma1 cpu cpu cpu cpu cpu cpu cpu dma channel 1 terminal count dmarq1 (input) note note note note the bus is always released. figure 6-6. single-step transfer example 2 cpu cpu cpu dma1 cpu dma1 cpu dma0 cpu dma0 cpu dma0 cpu dma1 cpu dma1 cpu dma channel 0 terminal count dma channel 1 terminal count dmarq1 (input) dmarq0 (input) note note note note note note note the bus is always released.
chapter 6 dma functions (dma controller) 270 preliminar y user ? s manual u16031ej2v1ud 6.4.3 block transfer mode in the block transfer mode, once transfer starts, the dmac continues the transfer operation without releasing the bus until a terminal count occurs. no other dma requests are acknowledged during block transfer. after the block transfer ends and the dmac releases the bus, another dma transfer can be acknowledged. the bus cycle of the cpu is not inserted during block transfer, but bus hold and refresh cycles are inserted in between dma transfer operations. the following shows an example of block transfer in which a higher priority dma request is issued. dma channels 2 and 3 are in the block transfer mode. figure 6-7. block transfer example cpu cpu cpu dma3 dma3 dma3 dma3 dma3 dma3 dma3 dma3 cpu dma2 dma2 dma2 dma2 dma2 dma channel 3 terminal count the bus is always released. dmarq3 (input) dmarq2 (input)
chapter 6 dma functions (dma controller) 271 preliminar y user ? s manual u16031ej2v1ud 6.5 transfer types 6.5.1 2-cycle transfer in 2-cycle transfer, data transfer is performed in two cycles, a read cycle (source to dmac) and a write cycle (dmac to destination). in the first cycle, the source address is output and reading is performed from the source to the dmac. in the second cycle, the destination address is output and writing is performed from the dmac to the destination. caution an idle cycle of 1 to 2 clocks is always inserted between a read cycle and a write cycle. figure 6-8. timing of 2-cycle dma transfer (sram external i/o) (1/2) (a) single transfer mode (0 waits, bmc register = 00h, level detection mode) wr (output) csm (output) of sram area t1 t2 ti note 1 ti note 1 t1 t2 dmarqx (input) csn (output) of external i/o area dmaakx (output) note 2 (output) sdcke (output) busclk (output) rd (output) bcyst (output) data sdras (output) sdcas (output) d0 to d31 (input) h h h data notes 1. this idle state (ti) is independent of the bcc register setting. 2. uube/uudqm, ulbe/uldqm, llbe/lldqm, lube/ludqm remarks 1. the broken lines indicate the high-impedance state. 2. n = 0 to 7, m = 0 to 7 (n m) x = 0 to 3
chapter 6 dma functions (dma controller) 272 preliminar y user ? s manual u16031ej2v1ud figure 6-8. timing of 2-cycle dma transfer (sram external i/o) (2/2) (b) single transfer mode (0 waits, bmc register = 00h, edge detection mode) t1 t2 ti note 1 ti note 1 t1 t2 dmarqx (input) csn (output) of external i/o area dmaakx (output) wr (output) note 2 (output) sdcke (output) busclk (output) rd (output) csm (output) of sram area bcyst (output) data sdras (output) sdcas (output) d0 to d31 (input) h h h data notes 1. this idle state (ti) is independent of the bcc register setting. 2. uube/uudqm, ulbe/uldqm, llbe/lldqm, lube/ludqm remarks 1. the broken lines indicate the high-impedance state. 2. n = 0 to 7, m = 0 to 7 (n m) x = 0 to 3
chapter 6 dma functions (dma controller) 273 preliminar y user ? s manual u16031ej2v1ud figure 6-9. timing of 2-cycle dma transfer (sdram sram): single transfer mode (sram data 1 wait, sdram latency = 2, bmc register = 00h, level detection mode) tw t2 tread tact busclk (output) tlate dmarqx (input) dmaakx (output) csm (output) of sram area ti note 1 t1 tlate ti note 1 bcyst (output) rd (output) wr (output) sdcke (output) note 2 (output) sdras (output) sdcas (output) d0 to d31 (input) data csn (output) of sdram area h h data notes 1. this idle state (ti) is independent of the bcc register setting. 2. uube/uudqm, ulbe/uldqm, llbe/lldqm, lube/ludqm remarks 1. the broken lines indicate the high-impedance state. 2. m = 0 to 7 n = 1, 3, 4, 6 x = 0 to 3
chapter 6 dma functions (dma controller) 274 preliminar y user ? s manual u16031ej2v1ud figure 6-10. timing of 2-cycle dma transfer (sram sdram): single transfer mode (sram data 1 wait, bmc register = 00h, edge detection mode) t1 tw t2 ti note 1 ti note 1 tact twr dmarqx (input) dmaakx (output) busclk (output) bcyst (output) csm (output) of sram area rd (output) wr (output) csn (output) of sdram area note 2 (output) sdcke (output) h sdras (output) sdcas (output) d0 to d31 (i/o) data data notes 1. this idle state (ti) is independent of the bcc register setting. 2. uube/uudqm, ulbe/uldqm, llbe/lldqm, lube/ludqm remarks 1. the broken lines indicate the high-impedance state. 2. m = 0 to 7 n = 1, 3, 4, 6 x = 0 to 3
chapter 6 dma functions (dma controller) 275 preliminar y user ? s manual u16031ej2v1ud figure 6-11. timing of 2-cycle dma transfer (sram external i/o): without speculative read t1 t2 t1 t2 a0 to a25 (output) csn (output) of sram area bcyst (output) t0 note 1 busclk (output) ti note 2 address address ti note 2 rd (output) wr (output) note 3 (output) d0 to d31 (i/o) wait (input) data 1 data 1 csn (output) of external i/o area notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is independent of the bcc register setting. 3. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state. 3. n = 0 to 7
chapter 6 dma functions (dma controller) 276 preliminar y user ? s manual u16031ej2v1ud figure 6-12. timing of 2-cycle dma transfer (sdram sram) (1/2) (a) without speculative read row col. tact tread tlate tlate t1 t2 t0 note 1 ti note 2 busclk (output) a0 to a25 (output) bcyst (output) address ti note 2 csn (output) transfer source h h sdras (output) we (output) sdcas (output) sdcke (output) csm (output) transfer source note 4 (output) d0 to d31 (i/o) wr (output) data data note 3 (output) notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is independent of the bcc register setting. 3. when xxwr output mode/xxdqm output mode is set (pfccta bit of pfcct register = 0) 4. when xxbe output mode/xxdqm output mode is set (pfccta bit of pfcct register = 1) remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 7 a = 0 to 3 xx = uu, ul, lu, ll
chapter 6 dma functions (dma controller) 277 preliminar y user ? s manual u16031ej2v1ud figure 6-12. timing of 2-cycle dma transfer (sdram sram) (2/2) (b) with speculative read, speculative read hit speculative read cycle (fill cycle of speculative read buffer) da.1 row col. tact tread tlate t1 t2 da.2 da.3 da.4 t1 t2 h h treadtreadtread tlate col.+4 col.+8 col.+c da.1 da.3 t0 note 1 address address t1 t2 da.2 address t1 t2 da.4 address busclk (output) a0 to a25 (output) sdras (output) we (output) bcyst (output) sdcas (output) sdcke (output) note 3 (output) d0 to d31 (i/o) wr (output) transfer destination csm (output) transfer source csn (output) ti note 2 ti note 2 ti note 2 ti note 2 ti note 2 ti note 2 ti note 2 ti note 2 ti note 2 ti note 2 notes 1. state (t0) inserted between bus cycles 2. this idle state (ti) is independent of the bcc register setting. 3. uudqm, uldqm, lldqm, ludqm remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 m = 0 to 7 3. da.: data
chapter 6 dma functions (dma controller) 278 preliminar y user?s manual u16031ej2v1ud (1) timing of dmarqn and dmaakn signals for 2-cycle transfer the targets of 2-cycle transfer are as follows. table 6-1. targets of 2-cycle transfer transfer destination external i/o/external memory on-chip peripheral i/o internal data ram internal instruction ram external i/o/external memory ??? on-chip peripheral i/o ??? transfer source internal data ram ?? remarks 1. : can be transferred, : cannot be transferred 2. for details, refer to table 6-4 minimum value of active width of dmaakn signal for 2-cycle transfer . the bus configuration is as shown below. figure 6-13. bus configuration <1> dma controller <3> internal data ram <2> internal instruction ram internal bus external bus <4> on-chip peripheral i/o external i/o/external memory <5> speculative read buffer <6> write buffer caution the internal bus operates in synchronization with the cpu clock, and the external bus operates in synchronization with the bus clock (busclk).
chapter 6 dma functions (dma controller) 279 preliminar y user ? s manual u16031ej2v1ud the active width of the dmaakn signal output by the dma controller is from the beginning of a read operation by the dma controller to the end of a write operation (n = 0 to 3). the dmaakn signal is not asserted in a cycle used to write/read the internal data ram. the active width of the dmaakn signal for each dma transfer is shown below. table 6-2. active width of dmaakn signal for 2-cycle transfer transfer destination external i/o/external memory on-chip peripheral i/o internal data ram internal instruction ram external i/o/external memory <5> (<7>) <1> <6> <5> (<7>) <1> <4> <5> (<7>) <1> <5> (<7>) <1> <2> on-chip peripheral i/o <4> <1> <6> <4> <1> <4> <4> <1> <4> <1> <2> transfer source internal data ram <1> <6> <1> <4> ? <1> <2> remark ( ): cycle without speculative reading or in case of speculative read miss-hit therefore, the correlation between external access during 2-cycle transfer (execution to external i/o/external memory) and the active width of the dmaakn signal is as follows. table 6-3. correlation between external access (execution to external i/o/external memory) and active width of dmaakn signal transfer destination speculative read function external i/o/ external memory on-chip peripheral i/o internal data ram internal instruction ram external i/o/external memory ??? on-chip peripheral i/o (a) ??? internal data ram none (a) ??? external i/o/external memory (b) (c) (c) (c) on-chip peripheral i/o (a) ??? transfer source internal data ram provided (a) ??? remarks : the dmaakn signal is asserted while dma access to/from external i/o/external memory is being executed. : the dmaakn signal may not be asserted while dma access to/from external i/o/external memory is being executed. (a): handshaking of the dmarqn and dmaakn signals may be completed before a write operation to the external i/o or external memory is executed. as soon as data has been transferred to the write buffer (<4> <1> <6> or <1> <6>), assertion of the dmaakn signal ends. if data of three buffers has already been stored in the write buffer separately, data transferred by dma is stored in the fourth buffer. subsequently, when a write operation of the stored data has taken place three times, transfer to the external i/o or external memory targeted by the last dmaakn signal is executed (<6> <7>).
chapter 6 dma functions (dma controller) 280 preliminar y user?s manual u16031ej2v1ud (b): handshaking of the dmarqn and dmaakn signals may be completed if a read operation from the external i/o or external memory (dma access) has been completed before handshaking of the dmarqn and dmaakn signals is completed, or before a write operation to the external i/o or external memory is executed. the active state of the dmaakn signal ends as soon as data has been transferred to the write buffer (<5> <1> <6>). if speculative reading hits, data is read from the external i/o or external memory when speculative reading has been completed. therefore, a read operation from the external i/o or external memory (<7> <5>) is executed before the dmaakn signal. while data is being transferred from the speculative read buffer to the write buffer (<5> <1> <6>) after that, the dmaakn signal is asserted. for example, if data of three buffers has already been stored in the write buffer, data transferred by dma is stored in the fourth buffer. after that, transfer to the external i/o or external memory (<6> <7>) targeted by the last dmaakn signal is executed when a write operation of the stored data has taken place three times. (c): a read operation from the external i/o or external memory (dma access) may be completed before handshaking of the dmarqn and dmaakn signals is completed. if speculative reading hits, because the data has already been transferred from the external i/o or external memory to the speculative read buffer (<7> <5>), execution to the external i/o or external memory (dma access) will have already been completed while the dmaakn signal was asserted (<5> <1> (<2>, <3> or <4>)). (2) dmaakn signal active width extension function the dmaakn signal is output in synchronization with the internal bus cycle during 2-cycle transfer, and is not synchronized with the external bus cycle (n = 0 to 3). the dma cycle differs depending on the configuration subject to dma transfer (refer to 6.5.1 (1) timing of dmarqn and dmaakn signals for 2-cycle transfer ). depending on the target of dma transfer, the configuration may allow the dmaakn signal to be asserted only for the duration of two internal system clocks. in this case, assertion of the dmaakn signal may not be sampled with busclk if the internal system clock is divided and the bus clock (busclk) is used (e.g., bmc register = 02h: internal system clock divided by three). to sample assertion of the dmaakn signal with busclk, extend the active width of the dmaakn signal by using the dakebc bit of the dtoc register and daken bit of the difc register.
chapter 6 dma functions (dma controller) 281 preliminar y user ? s manual u16031ej2v1ud the minimum value of the active width of the dmaakn during 2-cycle transfer is shown in the table below. table 6-4. minimum value of active width of dmaakn signal during 2-cycle transfer transfer destination speculative read function external i/o/ external memory on-chip peripheral i/o internal data ram internal instruction ram external i/o/external memory read cycle + 3 internal system clocks read cycle + (4+i) internal system clocks read cycle read cycle + internal instruction ram write cycle + 1 internal system clock on-chip peripheral i/o (6+i) internal system clocks (7+2i) internal system clocks (3+i) internal system clocks internal instruction ram write cycle + (4+i) internal system clocks internal data ram none 2 internal system clocks (3+i) internal system clocks ? internal instruction ram write cycle external i/o/external memory 5 internal system clocks (6+i) internal system clocks 2 internal system clocks internal instruction ram write cycle + 3 internal system clocks on-chip peripheral i/o (6+i) internal system clocks (7+2i) internal system clocks (3+i) internal system clocks internal instruction ram write cycle + (4+i) internal system clocks transfer source internal data ram provided 2 internal system clocks (3+i) internal system clocks ? internal instruction ram write cycle caution the function to extend the active width of the dmaakn signal can be used only during 2-cycle transfer (n = 0 to 3). it cannot be used during flyby transfer. the operation is not guaranteed if it is used during flyby transfer. during flyby transfer, the dmaakn signal synchronized with the bus cycle is output. remark i: number of wait cycles set by vswc register
chapter 6 dma functions (dma controller) 282 preliminar y user ? s manual u16031ej2v1ud (3) outline of 2-cycle transfer timing the timing of 2-cycle transfer is outlined below. figure 6-14. outline of timing during 2-cycle transfer (sram sram): divided by 1 (0 sram waits) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write remark n = 0 to 3
chapter 6 dma functions (dma controller) 283 preliminar y user ? s manual u16031ej2v1ud figure 6-15. outline of timing during 2-cycle transfer (sram sram): divided by 2 (0 sram waits) (a) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write (b) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write remark n = 0 to 3
chapter 6 dma functions (dma controller) 284 preliminar y user ? s manual u16031ej2v1ud figure 6-16. outline of timing during 2-cycle transfer (sram sram): divided by 3 (0 sram waits) (1/2) (a) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write (b) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write remark n = 0 to 3
chapter 6 dma functions (dma controller) 285 preliminar y user ? s manual u16031ej2v1ud figure 6-16. outline of timing during 2-cycle transfer (sram sram): divided by 3 (0 sram waits) (2/2) (c) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write remark n = 0 to 3
chapter 6 dma functions (dma controller) 286 preliminar y user ? s manual u16031ej2v1ud figure 6-17. outline of timing during 2-cycle transfer (sram sram): divided by 4 (0 sram waits) (1/2) (a) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write (b) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write remark n = 0 to 3
chapter 6 dma functions (dma controller) 287 preliminar y user ? s manual u16031ej2v1ud figure 6-17. outline of timing during 2-cycle transfer (sram sram): divided by 4 (0 sram waits) (2/2) (c) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write (d) t1 t2 t1 t2 internal system clock (f clk ) external bus status external memory cycle dmaakn (output) busclk (output) read write read write remark n = 0 to 3
chapter 6 dma functions (dma controller) 288 preliminar y user ? s manual u16031ej2v1ud 6.5.2 flyby transfer since data is transferred in 1 cycle during a flyby transfer, a memory address is always output irrespective whether it is a source address or a destination address, and read/write signals of the memory and peripheral i/o become active at the same time. therefore, the external i/o is selected by the dmaak0 to dmaak3 signals. to perform a normal access to the external i/o by means other than dma transfer, externally and the csm and dmaakx signals (m = 0 to 7, x = 0 to 3), and connect the resultant signal to the chip select signal of the external i/o. a circuit example of a normal access, other than dma transfer, to external i/o is shown below. figure 6-18. circuit example when flyby transfer is performed between external i/o and sram ax to axx d0 to d7 oe we csn sram ax to axx d8 to d15 oe we csn sram external i/o d0 to d15 rd wr cs ax to axx d0 to d15 rd llwr, luwr csn ulwr, uuwr v850e/me2 iord csm iowr dmaakx remark n = 0 to 7, m = 0 to 7 (n m) x = 0 to 3
chapter 6 dma functions (dma controller) 289 preliminar y user?s manual u16031ej2v1ud figure 6-19. timing of dma flyby transfer (external i/o sdram) (1/3) (a) single transfer mode tf note 3 twr tact twr tf note 3 t0 note 2 ti note 1 ti note 1 ti note 1 ti note 1 row h h col. a0 to a25 (output) csn (output) sdras (output) we (output) bcyst (output) iowr (ouptut) iord (ouptut) sdcas (output) sdcke (output) note 4 (ouptut) d0 to d15 (input) busclk (output) dmarqx (input) internal dma request signal dmaakx (output) tcx (output) ti note 1 ti note 1 ti note 1 ti note 1 t0 note 2 ti note 1 data data col. notes 1. this idle state (ti) is independent of the bcc register setting. 2. state (t0) inserted between bus cycles 3. this wait (tf) is inserted by means of the fwc register setting. 4. uudqm, uldqm, lldqm, ludqm caution in the tf state during sdram flyby transfer, wait cycles of the set value of the fwc register + 1 are always inserted (one wait cycle is inserted when the set value is 0 (the case where the set value is 0 is shown above)). remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state. 3. x = 0 to 3 n = 1, 3, 4, 6 4. col.: column address row: row address
chapter 6 dma functions (dma controller) 290 preliminar y user?s manual u16031ej2v1ud figure 6-19. timing of dma flyby transfer (external i/o sdram) (2/3) (b) single-step transfer mode ti note 3 twr tact twr ti note 3 t0 note 2 a0 to a25 (output) csn (output) sdras (output) we (output) bcyst (output) iowr (output) iord (output) sdcas (output) sdcke (output) note 4 (output) d0 to d15 (input) busclk (output) ti note 1 ti note 1 ti note 1 ti note 1 row h h col. dmarqx (input) internal dma request signal dmaakx (output) tcx (output) ti note 1 t0 note 2 ti note 1 ti note 1 data data col. notes 1. this idle state (ti) is independent of the bcc register setting. 2. state (t0) inserted between bus cycles 3. this wait (tf) is inserted by means of the fwc register setting. 4. uudqm, uldqm, lldqm, ludqm caution in the tf state during sdram flyby transfer, wait cycles of the set value of the fwc register + 1 are always inserted (one wait cycle is inserted when the set value is 0 (the case where the set value is 0 is shown above)). remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state. 3. x = 0 to 3 n = 1, 3, 4, 6 4. col.: column address row: row address
chapter 6 dma functions (dma controller) 291 preliminar y user?s manual u16031ej2v1ud figure 6-19. timing of dma flyby transfer (external i/o sdram) (3/3) (c) block transfer mode tact twr ti note 3 ti note 3 twr t0 note 2 t0 note 2 ti note 1 ti note 1 ti note 1 row h h col. a0 to a25 (output) csn (output) sdras (output) we (output) bcyst (output) iowr (output) iord (output) sdcas (output) sdcke (output) note 4 (output) d0 to d15 (input) busclk (output) dmarqx (input) internal dma request signal dmaakx (output) tcx (output) col. data data notes 1. this idle state (ti) is independent of the bcc register setting. 2. state (t0) inserted between bus cycles 3. this wait (tf) is inserted by means of the fwc register setting. 4. uudqm, uldqm, lldqm, ludqm caution in the tf state during sdram flyby transfer, wait cycles of the set value of the fwc register + 1 are always inserted (one wait cycle is inserted when the set value is 0 (the case where the set value is 0 is shown above)). remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state. 3. x = 0 to 3 n = 1, 3, 4, 6 4. col.: column address row: row address
chapter 6 dma functions (dma controller) 292 preliminar y user ? s manual u16031ej2v1ud figure 6-20. timing of dma flyby transfer (sram external i/o) (1/2) (a) with speculative read/without speculative read, 32-bit bus width t1 t2 tw ti note 4 t1 tf note 2 t2 tasw note 3 t1 tf note 2 t2 busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 5 (output) d0 to d31 (input) wait (input) iowr (output) iord (output) h address address t0 note 1 h t0 note 1 t0 note 1 data data data address notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. this address setup wait (tasw) is inserted by means of the asc register setting. 4. this idle state (ti) is inserted by means of the fic register setting. 5. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 6 dma functions (dma controller) 293 preliminar y user ? s manual u16031ej2v1ud figure 6-20. timing of dma flyby transfer (sram external i/o) (2/2) (b) with speculative read/without speculative read, 16-bit bus width, 32-bit data transfer address a+2 address a data t1 t2 tf note 2 ti note 4 t2 tasw note 3 t1 data t1 t2 data address b address b+2 tf note 2 ti note 4 t2 tasw note 3 t1 h t0 note 1 busclk (output) a0 to a25 (output) rd (output) wr (output) note 5 (output) d0 to d15 (input) wait (input) iowr (output) iord (output) h t0 note 1 bcyst (output) cs0 to cs7 (output) data notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. this address setup wait (tasw) is inserted by means of the asc register setting. 4. this idle state (ti) is inserted by means of the fic register setting. 5. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 6 dma functions (dma controller) 294 preliminar y user ? s manual u16031ej2v1ud figure 6-21. timing of dma flyby transfer (external i/o sram) (1/2) (a) with speculative read/without speculative read, 32-bit bus width t1 t2 tw ti note 4 t1 tf note 2 t2 tasw note 3 t1 tf note 2 t2 address h h address address t0 note 1 busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 5 (output) d0 to d31 (input) wait (input) iowr (output) iord (output) t0 note 1 t0 note 1 data data data notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. this address setup wait (tasw) is inserted by means of the asc register setting. 4. this idle state (ti) is inserted by means of the fic register setting. 5. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 6 dma functions (dma controller) 295 preliminar y user ? s manual u16031ej2v1ud figure 6-21. timing of dma flyby transfer (external i/o sram) (2/2) (b) with speculative read/without speculative read, 16-bit bus width, 32-bit data transfer t1 t2 tf note 2 ti note 4 t2 tasw note 3 t1 t1 t2 tf note 2 ti note 4 t2 tasw note 3 t1 h h address a address a+2 t0 note 1 busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 5 (output) d0 to d15 (input) wait (input) iowr (output) iord (output) t0 note 1 address b address b+2 data data data data notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. this address setup wait (tasw) is inserted by means of the asc register setting. 4. this idle state (ti) is inserted by means of the fic register setting. 5. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 6 dma functions (dma controller) 296 preliminar y user ? s manual u16031ej2v1ud figure 6-22. timing of dma flyby transfer (page rom external i/o) (1/2) (a) with speculative read/without speculative read, 32-bit bus width t1 t2 tw ti note 4 t1 tf note 2 t2 tasw note 3 t1 tf note 2 t2 h address a2 t0 note 1 busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 5 (output) d0 to d31 (input) wait (input) iowr (output) iord (output) t0 note 1 t0 note 1 address data data data h notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. this address setup wait (tasw) is inserted by means of the asc register setting. 4. this idle state (ti) is inserted by means of the fic register setting. 5. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 6 dma functions (dma controller) 297 preliminar y user ? s manual u16031ej2v1ud figure 6-22. timing of dma flyby transfer (page rom external i/o) (2/2) (b) with speculative read/without speculative read, 16-bit bus width, 32-bit data transfer t1 t2 tf note 2 t2 tasw note 3 t1 t1 t2 tf note 2 t2 t1 ti note 4 tf note 2 tf note 2 h address a address a+2 data data address b+2 t0 note 1 busclk (output) a0 to a25 (output) cs0 to cs7 (output) rd (output) wr (output) bcyst (output) note 5 (output) d0 to d15 (input) wait (input) iowr (output) iord (output) h t0 note 1 data data address b notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. this address setup wait (tasw) is inserted by means of the asc register setting. 4. this idle state (ti) is inserted by means of the fic register setting. 5. uube, ulbe, lube, llbe remarks 1. the circle { indicates the sampling timing. 2. the broken lines indicate the high-impedance state.
chapter 6 dma functions (dma controller) 298 preliminar y user?s manual u16031ej2v1ud figure 6-23. timing of dma flyby transfer (sdram external i/o) (1/2) (a) with speculative read/without speculative read, 32-bit bus width, cas latency = 2 tact tread row tf note 2 tlate tlate tact tread row tf note 2 tlate tlate tf note 2 ti note 3 tread tf note 2 tlate tlate a0 to a25 (output) csn (output) sdras (output) we (output) bcyst (output) iowr (output) iord (output) sdcas (output) sdcke (output) note 4 (output) d0 to d31 (input) h h col. col. col. t0 note 1 data data t0 note 1 t0 note 1 busclk (output) data notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. this idle state (ti) is inserted by means of the fic register setting. 4. uudqm, uldqm, lldqm, ludqm cautions 1. set the latency to other than 1 (ltm2 to ltm0 bits of scrn register = 001) during sdram flyby transfer. 2. in the tf state during sdram flyby transfer, wait cycles of the set value of the fwc register + 1 are inserted (one wait cycle is inserted when the set value is 0). remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address row: row address
chapter 6 dma functions (dma controller) 299 preliminar y user?s manual u16031ej2v1ud figure 6-23. timing of dma flyby transfer (sdram external i/o) (2/2) (b) with speculative read/without speculative read, 16-bit bus width, 32-bit data transfer, cas latency = 2 tact tread row tf note 2 tlate tlate tread tf note 2 tread tf note 2 h h col. col. t0 note 1 data data data a0 to a25 (output) csn (output) sdras (output) we (output) bcyst (output) iowr (output) iord (output) sdcas (output) sdcke (output) note 3 (output) d0 to d15 (input) busclk (output) tlate tlate tread tf note 2 t0 note 1 data col. col. notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. uudqm, uldqm, lldqm, ludqm cautions 1. set the latency to other than 1 (ltm2 to ltm0 bits of scrn register = 001) during sdram flyby transfer. 2. in the tf state during sdram flyby transfer, wait cycles of the set value of the fwc register + 1 are inserted (one wait cycle is inserted when the set value is 0 (the case where the set value is 0 is shown above)). remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address row: row address
chapter 6 dma functions (dma controller) 300 preliminar y user ? s manual u16031ej2v1ud figure 6-24. timing of dma flyby transfer (external i/o sdram) (1/2) (a) with speculative read/without speculative read, 32-bit bus width, cas latency = 2 tact twr row tf note 2 tact twr row tf note 2 tf note 2 tf note 2 tf note 2 twr tf notw 2 col. twr ti note 3 h h col. col. col. t0 note 1 a0 to a25 (output) csn (output) sdras (output) we (output) bcyst (output) iowr (output) iord (output) sdcas (output) sdcke (output) note 4 (output) d0 to d15 (input) busclk (output) t0 note 1 t0 note 1 t0 note 1 data data data data notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. this idle state (ti) is inserted by means of the fic register setting. 4. uudqm, uldqm, lldqm, ludqm caution in the tf state during sdram flyby transfer, wait cycles of the set value of the fwc register + 1 are inserted (one wait cycle is inserted when the set value is 0). remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address row: row address
chapter 6 dma functions (dma controller) 301 preliminar y user?s manual u16031ej2v1ud figure 6-24. timing of dma flyby transfer (external i/o sdram) (2/2) (b) with speculative read/without speculative read, 16-bit bus width, 32-bit data transfer, cas latency = 2 tact twr row tf note 2 tf note 2 twr twr tf note 2 tf note 2 twr h h col. col. t0 note 1 a0 to a25 (output) csn (output) sdras (output) we (output) bcyst (output) iowr (output) iord (output) sdcas (output) sdcke (output) note 3 (output) d0 to d15 (input) busclk (output) t0 note 1 col. col. data data data data notes 1. state (t0) inserted between bus cycles 2. this wait (tf) is inserted by means of the fwc register setting. 3. uudqm, uldqm, lldqm, ludqm caution in the tf state during sdram flyby transfer, wait cycles of the set value of the fwc register + 1 are inserted (one wait cycle is inserted when the set value is 0). remarks 1. the broken lines indicate the high-impedance state. 2. n = 1, 3, 4, 6 3. col.: column address row: row address
chapter 6 dma functions (dma controller) 302 preliminar y user?s manual u16031ej2v1ud 6.6 transfer object 6.6.1 transfer type and transfer object table 6-1 lists the relationships between transfer type and transfer object. the mark ? ? means ?transfer possible?, and the mark ? ? means ?transfer impossible?. table 6-5. relationship between transfer type and transfer object transfer destination 2-cycle transfer flyby transfer on-chip peripheral i/o note 1 external i/o internal data ram internal instruction ram external memory on-chip peripheral i/o external i/o internal data ram internal instruction ram external memory on-chip peripheral i/o note 1 ??? note 3 note 2 external i/o ??? note 3 ? internal data ram ?? note 3 ? transfer source external memory note 2 ?? note 3 note 2 ? notes 1. if the transfer object is the on-chip peripheral i/o, only the single transfer mode can be used. 2. transfer can also be executed between a little-endian area and a big-endian area. 3. when the internal instruction ram is in the write mode (irammn bit of iramm register = 1), it can be used only as a transfer destination. cautions 1. the operation is not guaranteed for combinations of transfer destination and source marked with ? ? in table 6-5. 2. in the case of flyby transfer, make the data bus width the same for the source and destination. 3. addresses between 3fff000h and 3ffffffh cannot be specified for the source and destination address of dma transfer. be sure to specify an address between ffff000h and fffffffh. 4. do not use dma transfer to set on-chip peripheral i/o registers and to read the set values. remarks 1. during 2-cycle dma transfer, if the data bus width of the transfer source and that of the transfer destination are different, the operation becomes as follows. if dma transfer is executed to transfer data of an on-chip peripheral i/o register (as a transfer source or destination), be sure to specify the same transfer size as the register size. for example, to execute dma transfer of an 8-bit register, be sure to specify byte (8-bit) transfer. <32-bit transfer> ? transfer from a 32-bit bus to a 16-bit bus a read cycle (32 bits) is generated and then a write cycle (16 bits) is generated twice consecutively. ? transfer from a 32-bit bus to an 8-bit bus a read cycle (32 bits) is generated and then a write cycle (8 bits) is generated 4 times consecutively.
chapter 6 dma functions (dma controller) 303 preliminar y user ? s manual u16031ej2v1ud ? transfer from a 16-bit bus to an 8-bit bus a read cycle (16 bits) is generated twice consecutively and then a write cycle (8 bits) is generated 4 times consecutively. ? transfer from a 16-bit bus to a 32-bit bus a read cycle (16 bits) is generated twice consecutively and then a write cycle (32 bits) is generated. for how to write data to the transfer destination, see remark 2 below. ? transfer from an 8-bit bus to a 32-bit bus a read cycle (8 bits) is generated 4 times consecutively and then a write cycle (32 bits) is generated. for how to write data to the transfer destination, see remark 2 below. ? transfer from an 8-bit bus to a 16-bit bus a read cycle (8 bits) is generated 4 times consecutively and then a write cycle (16 bits) is generated twice consecutively. for how to write data to the transfer destination, see remark 2 below. <16-bit transfer> ? transfer from a 32-bit bus to a 16-bit bus a read cycle (the higher 16 bits are high impedance) is generated and then a write cycle (16 bits) is generated. ? transfer from a 32-bit bus to an 8-bit bus a read cycle (the higher 16 bits are high impedance) is generated and then a write cycle (8 bits) is generated twice consecutively. ? transfer from a 16-bit bus to an 8-bit bus a read cycle (16 bits) is generated and then a write cycle (8 bits) is generated twice consecutively. ? transfer from a 16-bit bus to a 32-bit bus a read cycle (16 bits) is generated and then a write cycle (the higher 16 bits are high impedance) is generated. for how to write data to the transfer destination, see remark 2 below. ? transfer from an 8-bit bus to a 32-bit bus a read cycle (8 bits) is generated twice consecutively and then a write cycle (the higher 16 bits are high impedance) is generated. for how to write data to the transfer destination, see remark 2 below. ? transfer from an 8-bit bus to a 16-bit bus a read cycle (8 bits) is generated twice consecutively and then a write cycle (16 bits) is generated. for how to write data to the transfer destination, see remark 2 below. <8-bit transfer> ? transfer from a 32-bit bus to a 16-bit bus a read cycle (the higher 24 bits are high impedance) is generated and then a write cycle (the higher 8 bits are high impedance) is generated. ? transfer from a 32-bit bus to an 8-bit bus a read cycle (the higher 24 bits are high impedance) is generated and then a write cycle (8 bits) is generated. ? transfer from a 16-bit bus to an 8-bit bus a read cycle (the higher 8 bits are high impedance) is generated and then a write cycle (8 bits) is generated. ? transfer from a 16-bit bus to a 32-bit bus a read cycle (the higher 8 bits are high impedance) is generated and then a write cycle (the higher 24 bits are high impedance) is generated. for how to write data to the transfer destination, see remark 2 below.
chapter 6 dma functions (dma controller) 304 preliminar y user ? s manual u16031ej2v1ud ? transfer from an 8-bit bus to a 32-bit bus a read cycle (8 bits) is generated and then a write cycle (the higher 24 bits are high impedance) is generated. for how to write data to the transfer destination, see remark 2 below. ? transfer from an 8-bit bus to a 16-bit bus a read cycle (8 bits) is generated and then a write cycle (the higher 8 bits are high impedance) is generated. for how to write data to the transfer destination, see remark 2 below. remarks 2. under the following conditions, data is written to the lower byte and then the higher byte of the transfer destination in the little-endian mode, and to the higher byte and lower byte of the destination in the big-endian mode. ? transfer from a 16-bit bus to a 32-bit bus ? transfer from an 8-bit bus to a 32-bit bus ? transfer from an 8-bit bus to a 16-bit bus 3. transfer between the little-endian area and the big-endian area is possible. 6.6.2 external bus cycles during dma transfer the external bus cycles during dma transfer are shown below. table 6-6. external bus cycles during dma transfer transfer type transfer object external bus cycle on-chip peripheral i/o, internal data ram, internal instruction ram none ? external i/o yes sram cycle 2-cycle transfer external memory yes memory access cycle set by the bct register flyby transfer between external memory and external i/o yes dma flyby transfer cycle accessing memory that is set as external memory by the bct register 6.7 dma channel priorities the dma channel priorities are fixed as follows. dma channel 0 > dma channel 1 > dma channel 2 > dma channel 3 in the block transfer mode, the channel used for transfer is never switched. in the single-step transfer mode, if a higher priority dma transfer request is issued while the bus is released, the higher priority dma transfer request is acknowledged. caution if dma is started by inputting the same signal to more than one dmarqn pin (n = 0 to 3), a dma channel with a lower priority may be acknowledged before a dma channel with a higher priority.
chapter 6 dma functions (dma controller) 305 preliminar y user ? s manual u16031ej2v1ud 6.8 next address setting function the dma source address registers (dsanh, dsanl), dma destination address registers (ddanh, ddanl), and dma transfer count register (dbcn) are buffer registers with a 2-stage fifo configuration (n = 0 to 3). when the terminal count is issued, these registers are automatically rewritten with the value that was set immediately before. therefore, during dma transfer, transfer is automatically started when a new dma transfer setting is made for these registers and the enn bit of the dchcn register, and mlen bit is set to 1 (however, the dma transfer end interrupt may be issued even if dma transfer is automatically started). figure 6-20 shows the configuration of the buffer register. figure 6-25. buffer register configuration data read data write master register slave register address/ count controller internal bus the actual dma transfer is executed in accordance with the contents of the slave register. the set values that are reflected in the master register and slave register differ as follows, depending on the timing (period) of setting the registers. (1) period from system reset to the beginning of the first dma transfer the set value is reflected in both the master register and slave register. (2) during dma transfer (period from the beginning to the end of dma transfer) the set value is reflected only in the master register and not in the slave register (the slave register holds the set value for the next dma transfer). however, the contents of the master register are automatically overwritten to the slave register after completion of dma transfer. if the value of each register is read during this period, the value of the slave register is read. (3) period from the end of dma transfer to the beginning of the next dma transfer the set value is reflected in both the master register and slave register. remark ? the end of dma transfer ? means either of the following. ? completion of dma transfer (terminal count) ? forced termination of dma transfer (setting the initn bit of the dma channel control register (dchcn) to 1)
chapter 6 dma functions (dma controller) 306 preliminar y user?s manual u16031ej2v1ud if the setting of a new dma transfer is made using the dsanh, dsanl, ddanl, and dbcn registers during dma transfer, the values of the registers are automatically updated after completion of transfer note . note before setting a new dma transfer, confirm the start of the preceding dma transfer. if the setting of the new dma transfer is made before the start of the preceding dma transfer, the new set value is overwritten to both the master register and slave register, and dma transfer according to the preceding set value cannot be executed.
chapter 6 dma functions (dma controller) 307 preliminar y user?s manual u16031ej2v1ud 6.9 dma transfer start factors there are 4 types of dma transfer start factors, as shown below. cautions 1. do not use two or more start factors ((1) to (4)) in combination for the same channel (if two or more start factors are generated at the same time, only one of them is valid, but the valid start factor cannot be identified). the operation is not guaranteed if two or more start factors are used in combination. 2. if dma transfer is started via software and if the software does not correctly detect whether the expected dma transfer operation has been completed through manipulation (setting to 1) of the stgn bit of the dchcn register, it cannot be guaranteed whether the next (second) manipulation of the stgn bit corresponds to the start of ?the next dma transfer expected by software? (n = 0 to 3). for example, suppose single transfer is started by manipulating the stgn bit. even if the stgn bit is manipulated next (the second time) without checking by software whether the single transfer has actually been executed, the next (second) dma transfer is not always executed. this is because the stgn bit may be manipulated the second time before the first dma transfer is started or completed because, for example, dma transfer with a higher priority had already been started when the stgn bit was manipulated for the first time. it is therefore necessary to manipulate the stgn bit next time (the second time) after checking whether dma transfer started by the first manipulation of the stgn bit has been completed. completion of dma transfer can be checked in the following ways. ? ? ? ? detecting the acknowledge signal (dmaakn) or terminal count signal (tcn) by using a peripheral port or interrupt ? ? ? ? checking the contents of the dbcn register
chapter 6 dma functions (dma controller) 308 preliminar y user ? s manual u16031ej2v1ud (1) request from an external pin (dmarqn) requests from the dmarqn pin are sampled each time the busclk signal rises (n = 0 to 3). hold the request from dmarqn pin until the corresponding dmaakn signal becomes active. if a state whereby the enn bit of the dchcn register = 1 and the tcn bit = 0 is set, the dmarqn signal becomes valid. if the dmarqn signal set by the dtfrn register becomes active in this status, dma transfer starts. (2) request from software if the stgn, enn, and tcn bits of the dchcn register are set as follows, dma transfer starts (n = 0 to 3). ? stgn bit = 1 ? enn bit = 1 ? tcn bit = 0 (3) request from on-chip peripheral i/o if, when the enn and tcn bits of the dchcn register are set as shown below, an interrupt request is issued from the on-chip peripheral i/o that is set in the dtfrn register, dma transfer starts (n = 0 to 3). ? enn bit = 1 ? tcn bit = 0 (4) request by usb (enabled only in single transfer mode) if a request is generated from the usb set to the dtfrn register when the enn and tcn bits of the dchcn register are set as follows, dma transfer starts (n = 0 to 3). ? enn bit = 1 ? tcn bit = 0 remark since the dmarqn signal is level-sampled and not edge-detected, to enable edge detection of a dma request, set an external interrupt request for the dma start trigger instead of using the dmarqn signal (n = 0 to 3).
chapter 6 dma functions (dma controller) 309 preliminar y user ? s manual u16031ej2v1ud 6.10 terminal count output upon dma transfer end the terminal count signal (tcn) becomes active for one clock of busclk during the last dma transfer cycle (n = 3 to 0). the tcn signal becomes active in the clock following the clock in which the bcyst signal becomes active during the last dma transfer cycle. figure 6-26. terminal count signal (tcn) timing example (1) cpu cpu dman dman dman cpu cpu dmarqn (input) tcn (output) dma channel n terminal count remark n = 0 to 3 the tcn signal becomes active for one clock at the beginning of the write cycle of the last dma transfer when 2- cycle transfer is executed. when flyby transfer is executed, the tcn signal becomes active for one clock at the beginning of the last dma transfer cycle. figure 6-27. terminal count signal (tcn) timing example (2) (1) 2-cycle transfer read cycle 2-cycle transfer (last) write cycle busclk (output) tcn (output) (2) flyby transfer flyby transfer cycle (last) busclk (output) tcn (output) remark n = 0 to 3
chapter 6 dma functions (dma controller) 310 preliminar y user ? s manual u16031ej2v1ud 6.11 forcible interruption dma transfer can be forcibly interrupted by nmi input during dma transfer. at such a time, the dmac resets the enn bit of the dchcn register of all channels to 0 and the dma transfer disabled state is entered. an nmi request can then be acknowledged after the dma transfer that was being executed when the nmi was input is complete (n = 0 to 3).
chapter 6 dma functions (dma controller) 311 preliminar y user ? s manual u16031ej2v1ud 6.12 forcible termination dma transfer can be forcibly terminated by the initn bit of the dchcn register, in addition to the forcible interruption operation by means of nmi input (n = 0 to 3). an example of forcible termination by the initn bit of the dchcn register is illustrated below (n = 0 to 3). figure 6-28. example of forcible termination of dma transfer (a) block transfer through dma channel 3 is started during block transfer through dma channel 2 cpu cpu cpu cpu dma2 dma2 dma2 dma2 dma2 cpu dma3 dma3 dma3 dma3 cpu cpu cpu dmarq2 (input) dmarq3 (input) dma channel 3 transfer start dma channel 3 terminal count forcible termination of dma channel 2 transfer, bus released dsa2, dda2, dbc2, dadc2, dchc2 register set dchc2 (init2 bit = 1) register set dsa3, dda3, dbc3, dadc3, dchc3 register set e22 bit = 1 tc2 bit = 0 e22 bit 0 tc2 bit = 0 e33 bit = 1 tc3 bit = 0 e33 bit 0 tc3 bit 1 (b) when transfer is aborted during dma channel 1 block transfer, and transfer under another condition is executed cpu cpu cpu cpu dma1 dma1 dma1 dma1 dma1 dma1 cpu cpu cpu cpu dma1 dma1 dma1 cpu dmarq1 (input) forcible termination of dma channel 1 transfer, bus released dma channel 1 terminal count dsa1, dda1, dbc1, dadc1, dchc1 register set dadc1, dchc1 register set dchc1 (init1 bit = 1) register set dsa1, dda1, dbc1 register set e11 bit = 1 tc1 bit = 0 e11 bit 0 tc1 bit = 0 e11 bit 1 tc1 bit = 0 e11 bit 0 tc1 bit 1 remark the values of the dsan, ddan, and dbcn registers (n = 0 to 3) are retained even when dma transfer is forcibly stopped, because these registers are fifo-configured buffer registers. the next transfer condition can be set to these registers even while dma transfer is in progress. on the other hand, the setting of the dadcn and dchcn registers is invalid during dma transfer because these registers are not buffer registers (see 6.8 next address setting function , 6.3.4 dma addressing control registers 0 to 3 (dadc0 to dadc3) , and 6.3.5 dma channel control registers 0 to 3 (dchc0 to dchc3) ).
chapter 6 dma functions (dma controller) 312 preliminar y user?s manual u16031ej2v1ud 6.13 times related to dma transfer the overhead before and after dma transfer and minimum execution clock for dma transfer are shown below. in the case of external memory access, the time depends on the type of external memory connected. table 6-7. number of minimum execution clocks in dma cycle dma cycle number of minimum execution clocks <1> time to respond to dma request 4 clocks note 1 external memory access differs depending on the memory connected <2> memory access internal data ram or internal instruction ram (read mode) access 2 clocks note 2 notes 1. if an external interrupt (intpn) is specified as a factor of starting dma transfer, noise elimination time is added (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, or l1). 2. two clocks are required for the dma cycle. the minimum execution clock in the dma cycle in each transfer mode is as follows. single transfer: dma response time (<1>) + transfer source memory access (<2>) + 2 note + transfer destination memory access (<2>) block transfer: dma response time (<1>) + (transfer source memory access (<2>) + 2 note + transfer destination memory access (<2>)) number of transfers note two clocks are always inserted between the read cycle and write cycle of dma transfer. 6.14 maximum response time for dma transfer request the response time for a dma transfer request becomes the longest under the following conditions (in the sdram refresh cycle enabled state). however, the case when a higher priority dma transfer is generated is excluded. (1) condition 1 condition instruction fetch from an external memory in 8-bit data bus width response time tinst 4 + tref dmaakn (output) d0 to d31 (i/o) dmarqn (input) dma cycle refresh fetch (1/4) fetch (2/4) fetch (3/4) fetch (4/4) remark n = 0 to 3
chapter 6 dma functions (dma controller) 313 preliminar y user ? s manual u16031ej2v1ud (2) condition 2 condition word data access with an external memory in 8-bit data bus width response time tdata 4 + tref dmaakn (output) d0 to d31 (i/o) dmarqn (input) dma cycle refresh data (1/4) data (2/4) data (3/4) data (4/4) remark n = 0 to 3 (3) condition 3 condition instruction fetch from an external memory in 8-bit data bus width execution of a bit manipulation instruction (set1, clr1, or not1) response time tinst 4 + tdata 2 + tref dmaakn (output) d0 to d31 (i/o) dmarqn (input) dma cycle refresh data write data read fetch (4/4) fetch (3/4) fetch (2/4) fetch (1/4) remarks 1. tinst: number of clocks per bus cycle during instruction fetch tdata: number of clocks per bus cycle during data access tref: number of clocks per refresh cycle 2. n = 0 to 3
chapter 6 dma functions (dma controller) 314 preliminar y user?s manual u16031ej2v1ud 6.15 cautions (1) memory boundary the transfer operation is not guaranteed if the source or the destination address exceeds the area of dma objects (external memory, internal data ram, internal instruction ram, or peripheral i/o) during dma transfer. (2) transfer of misaligned data dma transfer of 32-/16-bit bus width misaligned data is not supported. if the source or the destination address is set to an odd address, the lsb of the address is forcibly handled as ?0?. (3) bus arbitration for cpu when dma transfer is executed to transfer data to/from an external device, the cpu can access internal data ram and internal instruction ram note not being used for dma transfer. because the dma controller has a priority higher than the cpu acquiring bus mastership, a cpu access that takes place during dma transfer is kept waiting until the preceding dma transfer is completed and the bus is released to the cpu. if dma transfer is executed between the external memory and on-chip peripheral i/o, however, the cpu can access the internal data ram and internal instruction ram note . note when the irammn bit of the iramm register = 0 (n = 0, 1) (4) holding dmarqn signal be sure to keep the dmarqn signal active until the dmaakn signal becomes active (n = 0 to 3). (5) dmaakn signal output when the transfer object is internal data ram, the dmaakn signal is not output during a dma cycle for internal data ram (for example, if 2-cycle transfer is performed from internal data ram to an external memory, the dmaakn signal is output only during a dma write cycle for the external memory). if the transfer object is the on-chip peripheral i/o or internal instruction ram, the dmaakn signal is output even in the dma cycle executed on the on-chip peripheral i/o or internal instruction ram. (6) dma start factors do not start two or more dma channels with the same factor. if two or more dma channels are started with the same factor, the dma channel with the lower priority may be accepted before the dma channel with the higher priority.
chapter 6 dma functions (dma controller) 315 preliminar y user ? s manual u16031ej2v1ud (7) read values of dsan and ddan registers if the values of the dsan and ddan registers are read during dma transfer, the values in the middle of being updated may be read (n = 0 to 3). for example, if the dsanh register and the dsanl register are read in that order when the value of the dma transfer source address (dsan register) is ? 0000ffffh ? and the counting direction is incremental (when the sadn1 and sadn0 bits of the dadcn register = 00), the value of the dsanl register differs as follows depending on whether dma transfer is executed immediately after the dsanh register has been read. (a) if dma transfer does not occur while the dsan register is being read <1> reading dsanh register: dsanh = 0000h <2> reading dsanl register: dsanl = ffffh (b) if dma transfer occurs while the dsan register is being read <1> reading dsanh register: dsanh = 0000h <2> occurrence of dma transfer <3> incrementing dsan register : dsan = 00010000h <4> reading dsanl register: dsanl = 0000h 6.15.1 interrupt factors dma transfer is interrupted if the following factors are issued. ? bus hold ? refresh cycle if the factor that is interrupting dma transfer disappears, dma transfer promptly restarts. 6.16 dma transfer end when dma transfer ends and the tcn bit of the dchcn register is set to 1, a dma transfer end interrupt (intdman) is issued to the interrupt controller (intc) (n = 0 to 3).
316 preliminar y user?s manual u16031ej2v1ud chapter 7 interrupt/exception processing function the v850e/me2 is provided with a dedicated interrupt controller (intc) for interrupt servicing and can process a total of 91 interrupt requests. an interrupt is an event that occurs independently of program execution, and an exception is an event whose occurrence is dependent on program execution. the v850e/me2 can process interrupt requests from the on-chip peripheral hardware and external sources. moreover, exception processing can be started by the trap instruction (software exception) or by generation of an exception event (i.e. fetching of an illegal opcode) (exception trap). 7.1 features { interrupts  non-maskable interrupts: 1 source  maskable interrupts: 90 sources  8 levels of programmable priorities (maskable interrupts)  multiple interrupt control according to priority  masks can be specified for each maskable interrupt request.  noise elimination note , edge detection, and valid edge specification for external interrupt request signals. note for details of the noise eliminator, see 14.6 noise eliminator . { exceptions  software exceptions: 32 sources  exception traps: 2 sources (illegal opcode exception and debug trap) interrupt/exception sources are listed in table 7-1.
chapter 7 interrupt/exception proc essing f unction 317 preliminar y user?s manual u16031ej2v1ud table 7-1. interrupt/exception source list (1/3) interrupt/exception source type classification name controlling register generating source generating unit default priority exception code handler address restored pc reset interrupt reset ? reset input ?? 0000h 00100000h undefined non-maskable interrupt nmi0 ? nmi input ?? 0010h 00000010h nextpc exception trap0n note ? trap instruction ?? 004nh note 00000040h nextpc software exception exception trap1n note ? trap instruction ?? 005nh note 00000050h nextpc exception trap exception ilgop/ dbg0 ? illegal opcode/ dbtrap instruction ?? 0060h 00000060h nextpc interrupt intp10 p1ic0 intp10 pin pin 0 0080h 00000080h nextpc interrupt intp11 p1ic1 intp11 pin pin 1 0090h 00000090h nextpc interrupt intp21 p2ic1 intp21 pin pin 2 00a0h 000000a0h nextpc interrupt intp22 p2ic2 intp22 pin pin 3 00b0h 000000b0h nextpc interrupt intp23 p2ic3 intp23 pin pin 4 00c0h 000000c0h nextpc interrupt intp24 p2ic4 intp24 pin pin 5 00d0h 000000d0h nextpc interrupt intp25 p2ic5 intp25 pin pin 6 00e0h 000000e0h nextpc interrupt intp50 p5ic0 intp50 pin pin 7 00f0h 000000f0h nextpc interrupt intp51 p5ic1 intp51 pin pin 8 0100h 00000100h nextpc interrupt intp52 p5ic2 intp52 pin pin 9 0110h 00000110h nextpc interrupt intp65 p6ic5 intp65 pin pin 10 0120h 00000120h nextpc interrupt intp66 p6ic6 intp66 pin pin 11 0130h 00000130h nextpc interrupt intp67 p6ic7 intp67 pin pin 12 0140h 00000140h nextpc interrupt intpd0 pdic0 intpd0 pin pin 13 0150h 00000150h nextpc interrupt intpd1 pdic1 intpd1 pin pin 14 0160h 00000160h nextpc interrupt intpd2 pdic2 intpd2 pin pin 15 0170h 00000170h nextpc interrupt intpd3 pdic3 intpd3 pin pin 16 0180h 00000180h nextpc interrupt intpd4 pdic4 intpd4 pin pin 17 0190h 00000190h nextpc interrupt intpd5 pdic5 intpd5 pin pin 18 01a0h 000001a0h nextpc interrupt intpd6 pdic6 intpd6 pin pin 19 01b0h 000001b0h nextpc interrupt intpd7 pdic7 intpd7 pin pin 20 01c0h 000001c0h nextpc interrupt intpd8 pdic8 intpd8 pin pin 21 01d0h 000001d0h nextpc interrupt intpd9 pdic9 intpd9 pin pin 22 01e0h 000001e0h nextpc interrupt intpd10 pdic10 intpd10 pin pin 23 01f0h 000001f0h nextpc interrupt intpd11 pdic11 intpd11 pin pin 24 0200h 00000200h nextpc interrupt intpd12 pdic12 intpd12 pin pin 25 0210h 00000210h nextpc interrupt intpd13 pdic13 intpd13 pin pin 26 0220h 00000220h nextpc interrupt intpd14 pdic14 intpd14 pin pin 27 0230h 00000230h nextpc interrupt intpd15 pdic15 intpd15 pin pin 28 0240h 00000240h nextpc interrupt intpl0 plic0 intpl0 pin pin 29 0250h 00000250h nextpc interrupt intpl1 plic1 intpl1 pin pin 30 0260h 00000260h nextpc interrupt intovc0 ovcic0 timer c0 overflow rpu 31 0270h 00000270h nextpc interrupt intovc1 ovcic1 timer c1 overflow rpu 32 0280h 00000280h nextpc interrupt intovc2 ovcic2 timer c2 overflow rpu 33 0290h 00000290h nextpc maskable interrupt intovc3 ovcic3 timer c3 overflow rpu 34 02a0h 000002a0h nextpc note n = 0 to fh
chapter 7 interrupt/exception proc essing f unction 318 preliminar y user?s manual u16031ej2v1ud table 7-1. interrupt/exception source list (2/3) interrupt/exception source type classification name controlling register generating source generating unit default priority exception code handler address restored pc interrupt intovc4 ovcic4 timer c4 overflow rpu 35 02b0h 000002b0h nextpc interrupt intovc5 ovcic5 timer c5 overflow rpu 36 02c0h 000002c0h nextpc interrupt intpc00/ intccc00 ccc0ic0 match of intpc00 pin/ccc00 pin/rpu 37 02d0h 000002d0h nextpc interrupt intpc01/ intccc01 ccc0ic1 match of intpc01 pin/ccc01 pin/rpu 38 02e0h 000002e0h nextpc interrupt intpc10/ intccc10 ccc1ic0 match of intpc10 pin/ccc10 pin/rpu 39 02f0h 000002f0h nextpc interrupt intpc11/ intccc11 ccc1ic1 match of intpc11 pin/ccc11 pin/rpu 40 0300h 00000300h nextpc interrupt intpc20/ intccc20 ccc2ic0 match of intpc20 pin/ccc20 pin/rpu 41 0310h 00000310h nextpc interrupt intpc21/ intccc21 ccc2ic1 match of intpc21 pin/ccc21 pin/rpu 42 0320h 00000320h nextpc interrupt intpc30/ intccc30 ccc3ic0 match of intpc30 pin/ccc30 pin/rpu 43 0330h 00000330h nextpc interrupt intpc31/ intccc31 ccc3ic1 match of intpc31 pin/ccc31 pin/rpu 44 0340h 00000340h nextpc interrupt intccc40 ccc4ic0 ccc40 match rpu 45 0350h 00000350h nextpc interrupt intccc41 ccc4ic1 ccc41 match rpu 46 0360h 00000360h nextpc interrupt intccc50 ccc5ic0 ccc50 match rpu 47 0370h 00000370h nextpc interrupt intccc51 ccc5ic1 ccc51 match rpu 48 0380h 00000380h nextpc interrupt intcmd0 cmdic0 cmd0 match rpu 49 0390h 00000390h nextpc interrupt intcmd1 cmdic1 cmd1 match rpu 50 03a0h 000003a0h nextpc interrupt intcmd2 cmdic2 cmd2 match rpu 51 03b0h 000003b0h nextpc interrupt intcmd3 cmdic3 cmd3 match rpu 52 03c0h 000003c0h nextpc interrupt intcc100 cc10ic0 cc100 match rpu 53 03d0h 000003d0h nextpc interrupt intcc101 cc10ic1 cc101 match rpu 54 03e0h 000003e0h nextpc interrupt intcm100 cm10ic0 cm100 match rpu 55 03f0h 000003f0h nextpc interrupt intcm101 cm10ic1 cm101 match rpu 56 0400h 00000400h nextpc interrupt intov10 ov1ic0 timer enc10 overflow rpu 57 0410h 00000410h nextpc interrupt intud10 ud1ic0 timer enc10 underflow rpu 58 0420h 00000420h nextpc interrupt intcc110 cc11ic0 cc110 match rpu 59 0430h 00000430h nextpc interrupt intcc111 cc11ic1 cc111 match rpu 60 0440h 00000440h nextpc interrupt intcm110 cm11ic0 cm110 match rpu 61 0450h 00000450h nextpc interrupt intcm111 cm11ic1 cm111 match rpu 62 0460h 00000460h nextpc interrupt intov11 ov1ic1 timer enc11 overflow rpu 63 0470h 00000470h nextpc interrupt intud11 ud1ic1 timer enc11 underflow rpu 64 0480h 00000480h nextpc interrupt intdma0 dmaic0 end of dma0 transfer dma 65 0490h 00000490h nextpc interrupt intdma1 dmaic1 end of dma1 transfer dma 66 04a0h 000004a0h nextpc interrupt intdma2 dmaic2 end of dma2 transfer dma 67 04b0h 000004b0h nextpc interrupt intdma3 dmaic3 end of dma3 transfer dma 68 04c0h 000004c0h nextpc interrupt intcsi30 csi3ic0 csi30 transmission/ reception completion sio 69 04d0h 000004d0h nextpc maskable interrupt intcovf30 covf3ic0 csi30buf overflow sio 70 04e0h 000004e0h nextpc
chapter 7 interrupt/exception proc essing f unction 319 preliminar y user?s manual u16031ej2v1ud table 7-1. interrupt/exception source list (3/3) interrupt/exception source type classification name controlling register generating source generating unit default priority exception code handler address restored pc interrupt intcsi31 csi3ic1 csi31 transmission/ reception completion sio 71 04f0h 000004f0h nextpc interrupt intcovf31 covf3ic1 csi31buf overflow sio 72 0500h 00000500h nextpc interrupt ubtire0 ureic0 uartb0 reception error sio 73 0510h 00000510h nextpc interrupt ubtir0 uric0 uartb0 reception completion sio 74 0520h 00000520h nextpc interrupt ubtit0 utic0 uartb0 transmission completion sio 75 0530h 00000530h nextpc interrupt ubtif0 uific0 uartb0 fifo transmission completion sio 76 0540h 00000540h nextpc interrupt ubtito0 utoic0 uartb0 reception timeout sio 77 0550h 00000550h nextpc interrupt ubtire1 ureic1 uartb1 reception error sio 78 0560h 00000560h nextpc interrupt ubtir1 uric1 uartb1 reception completion sio 79 0570h 00000570h nextpc interrupt ubtit1 utic1 uartb1 transmission completion sio 80 0580h 00000580h nextpc interrupt ubtif1 uific1 uartb1 fifo transmission completion sio 81 0590h 00000590h nextpc interrupt ubtito1 utoic1 uartb1 reception timeout sio 82 05a0h 000005a0h nextpc interrupt intad adic end of a/d conversion adc 83 05b0h 000005b0h nextpc interrupt intusb0b us0bic usb function status 0 usbf 84 05c0h 000005c0h nextpc interrupt intusb1b us1bic usb function status 1 usbf 85 05d0h 000005d0h nextpc interrupt intusb2b us2bic usb function status 2 usbf 86 05e0h 000005e0h nextpc interrupt usbsp2b usp2ic forcible end of usb function ep2 dma usbf 87 05f0h 000005f0h nextpc interrupt usbsp4b usp4ic forcible end of usb function ep4 dma usbf 88 0600h 00000600h nextpc maskable interrupt intrsum rsumic usb resume signal detection sie 89 0610h 00000610h nextpc remarks 1. default priority: the priority order when two or more maskable interrupt requests occur at the same time. the highest priority is 0. restored pc: the value of the pc saved to eipc or fepc when interrupt/exception processing is started. however, the value of the pc saved when an interrupt is acknowledged during divide instruction (div, divh, divu, divhu) execution is the value of the pc of the current instruction (div, divh, divu, divhu). nextpc: the pc value that starts the processing following interrupt/exception processing. 2. the execution address of the illegal instruction when an illegal opcode exception occurs is calculated by (restored pc ? 4).
chapter 7 interrupt/exception proc essing f unction 320 preliminar y user?s manual u16031ej2v1ud 7.2 non-maskable interrupts a non-maskable interrupt request is acknowledged unconditionally, even when interrupts are in the interrupt disabled (di) status. an nmi is not subject to priority control and takes precedence over all the other interrupts. a non-maskable interrupt request is input from the nmi pin. when the valid edge specified by bit 0 (nmir0) of external interrupt rising edge specification register 2 (intr2) or bit 0 (nmif0) of external interrupt falling edge specification register 2 (intf2) is detected at the nmi pin, the interrupt occurs. while the service program of the non-maskable interrupt is being executed (psw.np = 1), the acknowledgment of another non-maskable interrupt request is held pending. the pending nmi is acknowledged after the original service program of the non-maskable interrupt under execution has been terminated (by the reti instruction). note that if two or more nmi requests are input during the execution of the service program for an nmi, the number of nmis that will be acknowledged after psw.np is cleared to 0 is only one. remark psw.np: the np bit of the psw register.
chapter 7 interrupt/exception proc essing f unction 321 preliminar y user?s manual u16031ej2v1ud 7.2.1 operation if a non-maskable interrupt is generated, the cpu performs the following processing, and transfers control to the handler routine: <1> saves the restored pc to fepc. <2> saves the current psw to fepsw. <3> writes exception code 0010h to the higher halfword (fecc) of ecr. <4> sets the np and id bits of the psw and clears the ep bit. <5> sets the handler address (00000010h) corresponding to the non-maskable interrupt to the pc, and transfers control. the servicing configuration of a non-maskable interrupt is shown in figure 7-1. figure 7-1. servicing configuration of non-maskable interrupt psw.np fepc fepsw ecr.fecc psw.np psw.ep psw.id pc restored pc psw 0010h 1 0 1 00000010h 1 0 nmi input non-maskable interrupt request interrupt servicing interrupt request held pending intc acknowledged cpu processing
chapter 7 interrupt/exception proc essing f unction 322 preliminar y user ? s manual u16031ej2v1ud figure 7-2. acknowledging non-maskable interrupt request (a) if a new nmi request is generated while an nmi service program is being executed main routine nmi request nmi request (psw.np = 1) nmi request is held pending regardless of the value of the np bit of psw. pending nmi request serviced (b) if a new nmi request is generated twice while an nmi service program is being executed main routine nmi request nmi request held pending because nmi service program is being serviced only one nmi request is acknowledged even though two nmi requests are generated nmi request held pending because nmi service program is being serviced
chapter 7 interrupt/exception proc essing f unction 323 preliminar y user ? s manual u16031ej2v1ud 7.2.2 restore execution is restored from the non-maskable interrupt servicing by the reti instruction. when the reti instruction is executed, the cpu performs the following processing, and transfers control to the address of the restored pc. <1> restores the values of the pc and the psw from fepc and fepsw, respectively, because the ep bit of the psw is 0 and the np bit of the psw is 1. <2> transfers control back to the address of the restored pc and psw. figure 7-3 illustrates how the reti instruction is processed. figure 7-3. reti instruction processing psw.ep reti instruction psw.np original processing restored 1 1 0 0 pc psw eipc eipsw pc psw fepc fepsw caution when the psw.ep bit and psw.np bit are changed by the ldsr instruction during non- maskable interrupt servicing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set psw.ep back to 0 and psw.np back to 1 using the ldsr instruction immediately before the reti instruction. remark the solid line shows the cpu processing flow.
chapter 7 interrupt/exception proc essing f unction 324 preliminar y user ? s manual u16031ej2v1ud 7.2.3 non-maskable interrupt status flag (np) the np flag is a status flag that indicates that non-maskable interrupt (nmi) servicing is under execution. this flag is set when an nmi interrupt has been acknowledged, and masks all interrupt requests and exceptions to prohibit multiple interrupts from being acknowledged. 31 0 psw after reset 00000020h 7 np 6 ep 5 id 4 sat 3 cy 2 ov 1 sz 8 9 10 11 12 0 0 0 ss 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bit position bit name function 7 np nmi pending indicates whether nmi interrupt servicing is in progress. 0: no nmi interrupt servicing 1: nmi interrupt currently being serviced 7.2.4 edge detection function (1) external interrupt rising edge specification register 2 (intr2), external interrupt falling edge specification register 2 (intf2) these registers are used to specify the valid edge of the non-maskable interrupt (nmi). the nmir0 bit of the intr2 register and nmif0 bit of the intf2 register specify the rising edge, falling edge, or both the rising and falling edges of the nmi as the valid edge. these registers can be read or written in 8-bit or 1-bit units. 7 0 intr2 6 0 5 intr25 4 intr24 3 intr23 2 intr22 1 intr21 0 nmir0 address fffffc24h after reset 3fh 0 intf2 0 intf25 intf24 intf23 intf22 intf21 nmif0 fffffc04h 00h bit position bit name function specify the nmi pin ? s valid edge. nmif0 nmir0 operation 0 0 falling edge 0 1 rising edge 1 0 setting prohibited 1 1 both rising and falling edges 0nmir0 (intr2 register), nmif0 (intf2 register) remark for bits 5 to 1, see 7.3.9 (2) external interrupt rising edge specification register 2 (intr2), external interrupt falling edge specification register 2 (intf2) .
chapter 7 interrupt/exception proc essing f unction 325 preliminar y user ? s manual u16031ej2v1ud 7.3 maskable interrupts maskable interrupt requests can be masked by interrupt control registers. the v850e/me2 has 90 maskable interrupt sources. if two or more maskable interrupt requests are generated at the same time, they are acknowledged according to the default priority. in addition to the default priority, eight levels of priorities can be specified by using the interrupt control registers (programmable priority control). when an interrupt request has been acknowledged, the acknowledgment of other maskable interrupt requests is disabled and the interrupt disabled (di) status is set. when the ei instruction is executed in an interrupt service routine, the interrupt enabled (ei) status is set, which enables servicing of interrupts having a higher priority than the interrupt request in progress (specified by the interrupt control register). note that only interrupts with a higher priority will have this capability; interrupts with the same priority level cannot be nested. however, if multiple interrupts are executed, the following processing is necessary. <1> save eipc and eipsw in memory or a general-purpose register before executing the ei instruction. <2> execute the di instruction before executing the reti instruction, then reset eipc and eipsw with the values saved in <1>. 7.3.1 operation if a maskable interrupt occurs by int input, the cpu performs the following processing, and transfers control to a handler routine: <1> saves the restored pc to eipc. <2> saves the current psw to eipsw. <3> writes an exception code to the lower halfword of ecr (eicc). <4> sets the id bit of the psw and clears the ep bit. <5> sets the handler address corresponding to each interrupt to the pc, and transfers control. the servicing configuration of a maskable interrupt is shown in figure 7-4.
chapter 7 interrupt/exception proc essing f unction 326 preliminar y user ? s manual u16031ej2v1ud figure 7-4. maskable interrupt servicing int input xxif = 1 no xxmk = 0 no is the interrupt mask released? yes yes no no no maskable interrupt request interrupt request held pending psw.np psw.id 1 1 interrupt request held pending 0 0 interrupt servicing cpu processing intc accepted yes yes yes priority higher than that of interrupt currently being serviced? priority higher than that of other interrupt request? highest default priority of interrupt requests with the same priority? eipc eipsw ecr.eicc psw.ep psw.id corresponding bit of ispr note pc restored pc psw exception code 0 1 1 handler address note for the ispr register, see 7.3.7 in-service priority register (ispr) . the int input masked by the interrupt controllers and the int input that occurs while another interrupt is being serviced (when psw.np = 1 or psw.id = 1) are held pending internally by the interrupt controller. in such case, if the interrupts are unmasked, or when psw.np = 0 and psw.id = 0 as set by the reti and ldsr instructions, input of the pending int starts the new maskable interrupt servicing.
chapter 7 interrupt/exception proc essing f unction 327 preliminar y user ? s manual u16031ej2v1ud 7.3.2 restore recovery from maskable interrupt servicing is carried out by the reti instruction. when the reti instruction is executed, the cpu performs the following steps, and transfers control to the address of the restored pc. <1> restores the values of the pc and the psw from eipc and eipsw because the ep bit of the psw is 0 and the np bit of the psw is 0. <2> transfers control to the address of the restored pc and psw. figure 7-5 illustrates the processing of the reti instruction. figure 7-5. reti instruction processing psw.ep reti instruction psw.np restores original processing 1 1 0 0 pc psw corresponding bit of ispr note eipc eipsw 0 pc psw fepc fepsw note for the ispr register, see 7.3.7 in-service priority register (ispr) . caution when the psw.ep bit and the psw.np bit are changed by the ldsr instruction during maskable interrupt servicing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set psw.ep back to 0 and psw.np back to 0 using the ldsr instruction immediately before the reti instruction. remark the solid line shows the cpu processing flow.
chapter 7 interrupt/exception proc essing f unction 328 preliminar y user ? s manual u16031ej2v1ud 7.3.3 priorities of maskable interrupts the v850e/me2 provides multiple interrupt servicing in which an interrupt is acknowledged while another interrupt is being serviced. multiple interrupts can be controlled by priority levels. there are two types of priority level control: control based on the default priority levels, and control based on the programmable priority levels that are specified by the interrupt priority level specification bit (xxprn) of the interrupt control register (xxicn). when two or more interrupts having the same priority level specified by the xxprn bit are generated at the same time, interrupts are serviced in order depending on the priority level allocated to each interrupt request type (default priority level) beforehand. for more information, see table 7-1 interrupt/exception source list . the programmable priority control customizes interrupt requests into eight levels by setting the priority level specification flag. note that when an interrupt request is acknowledged, the id flag of psw is automatically set to 1. therefore, when multiple interrupts are to be used, clear the id flag to 0 beforehand (for example, by placing the ei instruction in the interrupt service program) to set the interrupt enable mode. remark xx: identification name of each peripheral unit (see table 7-2 ) n: peripheral unit number (see table 7-2 )
chapter 7 interrupt/exception proc essing f unction 329 preliminar y user ? s manual u16031ej2v1ud figure 7-6. example of processing in which another interrupt request is issued while an interrupt is being serviced (1/2) main routine ei ei interrupt request a (level 3) servicing of a servicing of b servicing of c interrupt request c (level 3) servicing of d servicing of e ei interrupt request e (level 2) servicing of f ei servicing of g interrupt request g (level 1) interrupt request h (level 1) servicing of h interrupt request b is acknowledged because the priority of b is higher than that of a and interrupts are enabled. although the priority of interrupt request d is higher than that of c, d is held pending because interrupts are disabled. interrupt request f is held pending even if interrupts are enabled because its priority is lower than that of e. interrupt request h is held pending even if interrupts are enabled because its priority is the same as that of g. interrupt request b (level 2) interrupt request d (level 2) interrupt request f (level 3) caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. remarks 1. a to u in the figure are pseudo interrupt request names shown for the sake of explanation. 2. the default priority in the figure indicates the relative priority between two interrupt requests.
chapter 7 interrupt/exception proc essing f unction 330 preliminar y user ? s manual u16031ej2v1ud figure 7-6. example of processing in which another interrupt request is issued while an interrupt is being serviced (2/2) main routine ei interrupt request i (level 2) servicing of i servicing of k interrupt request j (level 3) servicing of j interrupt request l (level 2) ei ei ei interrupt request o (level 3) interrupt request s (level 1) interrupt request k (level 1) servicing of l servicing of n servicing of m servicing of s servicing of u servicing of t interrupt request m (level 3) interrupt request n (level 1) servicing of o interrupt request p (level 2) interrupt request q (level 1) interrupt request r (level 0) interrupt request u (level 2) note 2 interrupt request t (level 2) note 1 servicing of p servicing of q servicing of r ei if levels 3 to 0 are acknowledged interrupt request j is held pending because its priority is lower than that of i. k that occurs after j is acknowledged because it has the higher priority. interrupt requests m and n are held pending because servicing of l is performed in the interrupt disabled status. pending interrupt requests are acknowledged after servicing of interrupt request l. at this time, interrupt request n is acknowledged first even though m has occurred first because the priority of n is higher than that of m. pending interrupt requests t and u are acknowledged after servicing of s. because the priorities of t and u are the same, u is acknowledged first because it has the higher default priority, regardless of the order in which the interrupt requests have been generated. caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. notes 1. lower default priority 2. higher default priority
chapter 7 interrupt/exception proc essing f unction 331 preliminar y user ? s manual u16031ej2v1ud figure 7-7. example of servicing interrupt requests simultaneously generated default priority a > b > c main routine ei interrupt request a (level 2) interrupt request b (level 1) interrupt request c (level 1) servicing of interrupt request b . . servicing of interrupt request c servicing of interrupt request a interrupt request b and c are acknowledged first according to their priorities. because the priorities of b and c are the same, b is acknowledged first according to the default priority. caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. remark a to c in the figure are pseudo interrupt request names shown for the sake of explanation.
chapter 7 interrupt/exception proc essing f unction 332 preliminar y user ? s manual u16031ej2v1ud 7.3.4 interrupt control register (xxicn) an interrupt control register is assigned to each interrupt request (maskable interrupt) and sets the control conditions for each maskable interrupt request. this register can be read or written in 8-bit or 1-bit units. caution disable interrupts (di) to read the xxifn bit of the xxicn register. if the xxifn bit is read while interrupts are enabled (ei), the correct value may not be read if there is a conflict between acknowledging an interrupt and reading the bit. xxifn xxicn xxmkn 5 0 4 0 3 0 2 xxprn2 1 xxprn1 0 xxprn0 address fffff110h to fffff1c2h after reset 47h <6> <7> bit position bit name function 7 xxifn this is an interrupt request flag. 0: interrupt request not issued 1: interrupt request issued the flag xxlfn is reset automatically by the hardware if an interrupt request is acknowledged. 6 xxmkn this is an interrupt mask flag. 0: interrupt servicing enabled 1: interrupt servicing disabled (pending) 8 levels of priority order are specified for each interrupt. xxprn2 xxprn1 xxprn0 interrupt priority specification bit 0 0 0 specifies level 0 (highest). 0 0 1 specifies level 1. 0 1 0 specifies level 2. 0 1 1 specifies level 3. 1 0 0 specifies level 4. 1 0 1 specifies level 5. 1 1 0 specifies level 6. 1 1 1 specifies level 7 (lowest). 2 to 0 xxprn2 to xxprn0 remark xx: identification name of each peripheral unit (see table 7-2 ) n: peripheral unit number (see table 7-2 ) the addresses and bits of the interrupt control registers are as follows:
chapter 7 interrupt/exception proc essing f unction 333 preliminar y user ? s manual u16031ej2v1ud table 7-2. addresses and bits of interrupt control registers (1/3) bit address register <7><6>543210 fffff110h p1ic0 p1if0 p1mk0 0 0 0 p1pr02 p1pr01 p1pr00 fffff112h p1ic1 p1if1 p1mk1 0 0 0 p1pr12 p1pr11 p1pr10 fffff114h p2ic1 p2if1 p2mk1 0 0 0 p2pr12 p2pr11 p2pr10 fffff116h p2ic2 p2if2 p2mk2 0 0 0 p2pr22 p2pr21 p2pr20 fffff118h p2ic3 p2if3 p2mk3 0 0 0 p2pr32 p2pr31 p2pr30 fffff11ah p2ic4 p2if4 p2mk4 0 0 0 p2pr42 p2pr41 p2pr40 fffff11ch p2ic5 p2if5 p2mk5 0 0 0 p2pr52 p2pr51 p2pr50 fffff11eh p5ic0 p5if0 p5mk0 0 0 0 p5pr02 p5pr01 p5pr00 fffff120h p5ic1 p5if1 p5mk1 0 0 0 p5pr12 p5pr11 p5pr10 fffff122h p5ic2 p5if2 p5mk2 0 0 0 p5pr22 p5pr21 p5pr20 fffff124h p6ic5 p6if5 p6mk5 0 0 0 p6pr52 p6pr51 p6pr50 fffff126h p6ic6 p6if6 p6mk6 0 0 0 p6pr62 p6pr61 p6pr60 fffff128h p6ic7 p6if7 p6mk7 0 0 0 p6pr72 p6pr71 p6pr70 fffff12ah pdic0 pdif0 pdmk0 0 0 0 pdpr02 pdpr01 pdpr00 fffff12ch pdic1 pdif1 pdmk1 0 0 0 pdpr12 pdpr11 pdpr10 fffff12eh pdic2 pdif2 pdmk2 0 0 0 pdpr22 pdpr21 pdpr20 fffff130h pdic3 pdif3 pdmk3 0 0 0 pdpr32 pdpr31 pdpr30 fffff132h pdic4 pdif4 pdmk4 0 0 0 pdpr42 pdpr41 pdpr40 fffff134h pdic5 pdif5 pdmk5 0 0 0 pdpr52 pdpr51 pdpr50 fffff136h pdic6 pdif6 pdmk6 0 0 0 pdpr62 pdpr61 pdpr60 fffff138h pdic7 pdif7 pdmk7 0 0 0 pdpr72 pdpr71 pdpr70 fffff13ah pdic8 pdif8 pdmk8 0 0 0 pdpr82 pdpr81 pdpr80 fffff13ch pdic9 pdif9 pdmk9 0 0 0 pdpr92 pdpr91 pdpr90 fffff13eh pdic10 pdif10 pdmk10 0 0 0 pdpr102 pdpr101 pdpr100 fffff140h pdic11 pdif11 pdmk11 0 0 0 pdpr112 pdpr111 pdpr110 fffff142h pdic12 pdif12 pdmk12 0 0 0 pdpr122 pdpr121 pdpr120 fffff144h pdic13 pdif13 pdmk13 0 0 0 pdpr132 pdpr131 pdpr130 fffff146h pdic14 pdif14 pdmk14 0 0 0 pdpr142 pdpr141 pdpr140 fffff148h pdic15 pdif15 pdmk15 0 0 0 pdpr152 pdpr151 pdpr150 fffff14ah plic0 plif0 plmk0 0 0 0 plpr02 plpr01 plpr00 fffff14ch plic1 plif1 plmk1 0 0 0 plpr12 plpr11 plpr10 fffff14eh ovcic0 ovcif0 ovcmk0 0 0 0 ovcpr02 ovcpr01 ovcpr00 fffff150h ovcic1 ovcif1 ovcmk1 0 0 0 ovcpr12 ovcpr11 ovcpr10 fffff152h ovcic2 ovcif2 ovcmk2 0 0 0 ovcpr22 ovcpr21 ovcpr20 fffff154h ovcic3 ovcif3 ovcmk3 0 0 0 ovcpr32 ovcpr31 ovcpr30 fffff156h ovcic4 ovcif4 ovcmk4 0 0 0 ovcpr42 ovcpr41 ovcpr40 fffff158h ovcic5 ovcif5 ovcmk5 0 0 0 ovcpr52 ovcpr51 ovcpr50 fffff15ah ccc0ic0 ccc0if0 ccc0mk0 0 0 0 ccc0pr02 ccc0pr01 ccc0pr00 fffff15ch ccc0ic1 ccc0if1 ccc0mk1 0 0 0 ccc0pr12 ccc0pr11 ccc0pr10 fffff15eh ccc1ic0 ccc1if0 ccc1mk0 0 0 0 ccc1pr02 ccc1pr01 ccc1pr00 fffff160h ccc1ic1 ccc1if1 ccc1mk1 0 0 0 ccc1pr12 ccc1pr11 ccc1pr10
chapter 7 interrupt/exception proc essing f unction 334 preliminar y user ? s manual u16031ej2v1ud table 7-2. addresses and bits of interrupt control registers (2/3) bit address register <7><6>543210 fffff162h ccc2ic0 ccc2if0 ccc2mk0 0 0 0 ccc2pr02 ccc2pr01 ccc2pr00 fffff164h ccc2ic1 ccc2if1 ccc2mk1 0 0 0 ccc2pr12 ccc2pr11 ccc2pr10 fffff166h ccc3ic0 ccc3if0 ccc3mk0 0 0 0 ccc3pr02 ccc3pr01 ccc3pr00 fffff168h ccc3ic1 ccc3if1 ccc3mk1 0 0 0 ccc3pr12 ccc3pr11 ccc3pr10 fffff16ah ccc4ic0 ccc4if0 ccc4mk0 0 0 0 ccc4pr02 ccc4pr01 ccc4pr00 fffff16ch ccc4ic1 ccc4if1 ccc4mk1 0 0 0 ccc4pr12 ccc4pr11 ccc4pr10 fffff16eh ccc5ic0 ccc5if0 ccc5mk0 0 0 0 ccc5pr02 ccc5pr01 ccc5pr00 fffff170h ccc5ic1 ccc5if1 ccc5mk1 0 0 0 ccc5pr12 ccc5pr11 ccc5pr10 fffff172h cmdic0 cmdif0 cmdmk0 0 0 0 cmdpr02 cmdpr01 cmdpr00 fffff174h cmdic1 cmdif1 cmdmk1 0 0 0 cmdpr12 cmdpr11 cmdpr10 fffff176h cmdic2 cmdif2 cmdmk2 0 0 0 cmdpr22 cmdpr21 cmdpr20 fffff178h cmdic3 cmdif3 cmdmk3 0 0 0 cmdpr32 cmdpr31 cmdpr30 fffff17ah cc10ic0 cc10if0 cc10mk0 0 0 0 cc10pr02 cc10pr01 cc10pr00 fffff17ch cc10ic1 cc10if1 cc10mk1 0 0 0 cc10pr12 cc10pr11 cc10pr10 fffff17eh cm10ic0 cm10if0 cm10mk0 0 0 0 cm10pr02 cm10pr01 cm10pr00 fffff180h cm10ic1 cm10if1 cm10mk1 0 0 0 cm10pr12 cm10pr11 cm10pr10 fffff182h ov1ic0 ov1if0 ov1mk0 0 0 0 ov1pr02 ov1pr01 ov1pr00 fffff184h ud1ic0 ud1if0 ud1mk0 0 0 0 ud1pr02 ud1pr01 ud1pr00 fffff186h cc11ic0 cc11if0 cc11mk0 0 0 0 cc11pr02 cc11pr01 cc11pr00 fffff188h cc11ic1 cc11if1 cc11mk1 0 0 0 cc11pr12 cc11pr11 cc11pr10 fffff18ah cm11ic0 cm11if0 cm11mk0 0 0 0 cm11pr02 cm11pr01 cm11pr00 fffff18ch cm11ic1 cm11if1 cm11mk1 0 0 0 cm11pr12 cm11pr11 cm11pr10 fffff18eh ov1ic1 ov1if1 ov1mk1 0 0 0 ov1pr12 ov1pr11 ov1pr10 fffff190h ud1ic1 ud1if1 ud1mk1 0 0 0 ud1pr12 ud1pr11 ud1pr10 fffff192h dmaic0 dmaif0 dmamk0 0 0 0 dmapr02 dmapr01 dmapr00 fffff194h dmaic1 dmaif1 dmamk1 0 0 0 dmapr12 dmapr11 dmapr10 fffff196h dmaic2 dmaif2 dmamk2 0 0 0 dmapr22 dmapr21 dmapr20 fffff198h dmaic3 dmaif3 dmamk3 0 0 0 dmapr32 dmapr31 dmapr30 fffff19ah csi3ic0 csi3if0 csi3mk0 0 0 0 csi3pr02 csi3pr01 csi3pr00 fffff19ch covf3ic0 covf3if0 covf3mk0 0 0 0 covf3pr02 covf3pr01 covf3pr00 fffff19eh csi3ic1 csi3if1 csi3mk1 0 0 0 csi3pr12 csi3pr11 csi3pr10 fffff1a0h covf3ic1 covf3if1 covf3mk1 0 0 0 covf3pr12 covf3pr11 covf3pr10 fffff1a2h ureic0 ureif0 uremk0 0 0 0 urepr02 urepr01 urepr00 fffff1a4h uric0 urif0 urmk0 0 0 0 urpr02 urpr01 urpr00 fffff1a6h utic0 utif0 utmk0 0 0 0 utpr02 utpr01 utpr00 fffff1a8h uific0 uifif0 uifmk0 0 0 0 uifpr02 uifpr01 uifpr00 fffff1aah utoic0 utoif0 utomk0 0 0 0 utopr02 utopr01 utopr00 fffff1ach ureic1 ureif1 uremk1 0 0 0 urepr12 urepr11 urepr10 fffff1aeh uric1 urif1 urmk1 0 0 0 urpr12 urpr11 urpr10 fffff1b0h utic1 utif1 utmk1 0 0 0 utpr12 utpr11 utpr10 fffff1b2h uific1 uifif1 uifmk1 0 0 0 uifpr12 uifpr11 uifpr10
chapter 7 interrupt/exception proc essing f unction 335 preliminar y user ? s manual u16031ej2v1ud table 7-2. addresses and bits of interrupt control registers (3/3) bit address register <7><6>543210 fffff1b4h utoic1 utoif1 utomk1 0 0 0 utopr12 utopr11 utopr10 fffff1b6h adic adif admk 0 0 0 adpr2 adpr1 adpr0 fffff1b8h us0bic us0bif us0bmk 0 0 0 us0bpr2 us0bpr1 us0bpr0 fffff1bah us1bic us1bif us1bmk 0 0 0 us1bpr2 us1bpr1 us1bpr0 fffff1bch us2bic us2bif us2bmk 0 0 0 us2bpr2 us2bpr1 us2bpr0 fffff1beh usp2ic usp2if usp2mk 0 0 0 usp2pr2 usp2pr1 usp2pr0 fffff1c0h usp4ic usp4if usp4mk 0 0 0 usp4pr2 usp4pr1 usp4pr0 fffff1c2h rsumic rsumif rsummk 0 0 0 rsumpr2 rsumpr1 rsumpr0 7.3.5 interrupt mask registers 0 to 5 (imr0 to imr5) these registers set the interrupt mask state for the maskable interrupts. the xxmkn bit of the imr0 to imr5 registers is equivalent to the xxmkn bit of the xxicn register. the imrm register (m = 0 to 5) can be read or written in 16-bit units. if the higher 8 bits of the imrm register are used as an imrmh register and the lower 8 bits as an imrml register, these registers can be read or written in 8-bit or 1-bit units. bits 15 to 10 of the imr5 register (bits 7 to 2 of the imr5h register) are fixed to 1. if these bits are not 1, the operation cannot be guaranteed. caution the device file defines the xxmkn bit of the xxicn register as a reserved word. if a bit is manipulated using the name of xxmkn, the contents of the xxicn register, instead of the imrm register, are rewritten (as a result, the contents of the imrm register are also rewritten).
chapter 7 interrupt/exception proc essing f unction 336 preliminar y user ? s manual u16031ej2v1ud pdmk2 p5mk0 imr0 pdmk1 p2mk5 pdmk0 p2mk4 p6mk7 p2mk3 p6mk6 p2mk2 p6mk5 p2mk1 p5mk2 p1mk1 p5mk1 p1mk0 address fffff100h after reset ffffh ovcmk0 pdmk10 imr1 plmk1 pdmk9 plmk0 pdmk8 pdmk15 pdmk7 pdmk14 pdmk6 pdmk13 pdmk5 pdmk12 pdmk4 pdmk11 pdmk3 address fffff102h after reset ffffh 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 ccc5mk0 ccc1mk0 imr2 ccc4mk1 ccc0mk1 ccc4mk0 ccc0mk0 ccc3mk1 ovcmk5 ccc3mk0 ovcmk4 ccc2mk1 ovcmk3 ccc2mk0 ovcmk2 ccc1mk1 ovcmk1 address fffff104h after reset ffffh 15 ov1mk1 7 cm10mk0 imr3 14 cm11mk1 6 cc10mk1 13 cm11mk0 5 cc10mk0 12 cc11mk1 4 cmdmk3 11 cc11mk0 3 cmdmk2 10 ud1mk0 2 cmdmk1 9 ov1mk0 1 cmdmk0 8 cm10mk1 ccc5mk1 address fffff106h after reset ffffh 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 0 urmk1 csi3mk1 imr4 uremk1 covf3mk0 utomk0 csi3mk0 uifmk0 dmamk3 utmk0 dmamk2 urmk0 dmamk1 uremk0 dmamk0 covf3mk1 ud1mk1 address fffff108h after reset ffffh 15 1 7 usp2mk imr5 14 1 6 us2bmk 13 1 5 us1bmk 12 1 4 us0bmk 11 1 3 admk 10 1 2 utomk1 9 rsummk 1 uifmk1 8 usp4mk utmk1 address fffff10ah after reset ffffh 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 0 bit position bit name function 15 to 0 xxmkn interrupt mask flag 0: interrupt servicing enabled 1: interrupt servicing disabled (pending) remark xx: identification name of each peripheral unit (see table 7-2 ) n: peripheral unit number (see table 7-2 )
chapter 7 interrupt/exception proc essing f unction 337 preliminar y user ? s manual u16031ej2v1ud 7.3.6 nmi reset status register (nrs) this register holds the valid edge input status of the nmi after the reset signal has been cleared. this register is read-only, in 8-bit or 1-bit units. cautions 1. the nmirs bit of the nrs register is set to 1 if an nmi occurs after the internal instruction ram has been set in the read mode (iramm0 bit of iramm register = 0). in this case, the status of the nmirs bit does not have to be checked because execution automatically branches to the nmi servicing routine. 2. the mask function of nmi input is valid after the reset signal has been cleared and before the internal instruction ram is set in the read mode (iramm0 bit of iramm register = 0). 0 0 0 0 0 0 0 nmirs 76543210 nrs address fffff80ch after reset 00h bit position bit name function 0 nmirs indicates the valid edge input status of nmi. 0: no nmi input 1: nmi input with the v850e/me2, the nmi is masked after the reset signal has been cleared. it is unmasked if the mode of the internal instruction ram is changed from the write mode (iramm0 bit of iramm register = 1) to the read mode (iramm0 bit of iramm register = 0) after the program has been downloaded to internal instruction ram bank 0. (the nrs register is controlled to prohibit a jump to the interrupt vector before the program is stored in the interrupt vector table.) if the nmi valid edge is input while the nmi is masked, the nmi input can be recognized by reading the nrs register.
chapter 7 interrupt/exception proc essing f unction 338 preliminar y user ? s manual u16031ej2v1ud 7.3.7 in-service priority register (ispr) this register holds the priority level of the maskable interrupt currently acknowledged. when an interrupt request is acknowledged, the bit of this register corresponding to the priority level of that interrupt request is set to 1 and remains set while the interrupt is serviced. when the reti instruction is executed, the bit corresponding to the interrupt request having the highest priority is automatically reset to 0 by hardware. however, it is not reset to 0 when execution is returned from non-maskable interrupt servicing or exception processing. this register is read-only, in 8-bit or 1-bit units. caution if an interrupt is acknowledged while the ispr register is being read in the interrupt enabled (ei) status, the value of the ispr register after the bits of the register have been set to 1 by acknowledging the interrupt may be read. to accurately read the value of the ispr register before an interrupt is acknowledged, read the register while interrupts are disabled (di status). ispr7 ispr ispr6 ispr5 ispr4 ispr3 ispr2 ispr1 ispr0 address fffff1fah after reset 00h <1> <2> <3> <4> <5> <6> <7> <0> bit position bit name function 7 to 0 ispr7 to ispr0 indicates priority of interrupt currently acknowledged 0: interrupt request with priority n not acknowledged 1: interrupt request with priority n acknowledged remark n = 0 to 7 (priority level) 7.3.8 maskable interrupt status flag (id) the id flag is bit 5 of the psw and controls the maskable interrupt ? s operating state, and stores control information regarding enabling or disabling of interrupt requests. 31 0 psw after reset 00000020h 7 np 6 ep 5 id 4 sat 3 cy 2 ov 1 sz 8 9 10 11 12 0 0 0 ss 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bit position bit name function 5 id indicates whether maskable interrupt servicing is enabled or disabled. 0: maskable interrupt request acknowledgment enabled 1: maskable interrupt request acknowledgment disabled (pending) this bit is set to 1 by the di instruction and reset to 0 by the ei instruction. its value is also modified by the reti instruction or ldsr instruction when referencing the psw. non-maskable interrupt requests and exceptions are acknowledged regardless of this flag. when a maskable interrupt is acknowledged, the id flag is automatically set to 1 by hardware. the interrupt request generated during the acknowledgment disabled period (id = 1) is acknowledged when the xxifn bit of xxicn is set to 1, and the id flag is reset to 0.
chapter 7 interrupt/exception proc essing f unction 339 preliminar y user ? s manual u16031ej2v1ud 7.3.9 selecting interrupt trigger mode the valid edge of the intpn, intpcm, tic0 to tic3, intpx, tiud10, tiud11, tcud10, tcud11, tclr10, and tclr11 pins can be selected by program (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, l0, l1, or d0 to d15, m = 00, 01, 10, 11, 20, 21, 30, or 31, x = 100, 101, 110, or 111). a trigger level can also be selected for the intpn pin. the following valid edges can be selected. ? rising edge ? falling edge ? both rising and falling edges the intpn, intpcm, tic0 to tic3, intpx, tiud10, tiud11, tcud10, tcud11, tclr10, and tclr11 signals detected by the edge are used as interrupt sources, to input a capture trigger, or to input an external count signal to the timers. the valid edge of these signals is specified by external interrupt rising edge specification registers 1, 2, 5, 6, al, and dh (intr1, intr2, intr5, intr6, intral, and intrdh), external interrupt falling edge specification registers 1, 2, 5, 6, al, and dh (intf1, intf2, intf5, intf6, intfal, and intfdh), valid edge select registers c0 to c3 (sesc0 to sesc3), and valid edge select registers 10 and 11 (sesa10 and sesa11). the trigger level is specified by external interrupt rising edge specification registers 1, 2, 5, 6, al, and dh (intr1, intr2, intr5, intr6, intral, and intrdh) and external interrupt falling edge specification registers 1, 2, 5, 6, al, and dh (intf1, intf2, intf5, intf6, intfal, and intfdh). (1) external interrupt rising edge specification register 1 (intr1), external interrupt falling edge specification register 1 (intf1) these registers are used to specify the trigger mode of the external interrupt requests (intp10 and intp11) input from external pins. the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intf10 and intr10 bits: intp10 ? intf11 and intr11 bits: intp11 the rising edge, falling edge, or both the rising and falling edges can be independently specified as the valid edge. each of these registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode of the intp10 and intp11 pins, set the pmc1 register. if the pmc1 register is set after the intr1 and intf1 registers have been set, an illegal interrupt may occur when the pmc1 register is set.
chapter 7 interrupt/exception proc essing f unction 340 preliminar y user ? s manual u16031ej2v1ud 7 0 intr1 6 0 5 0 4 0 3 0 2 0 1 intr11 0 intr10 address fffffc22h after reset 03h 0 intf1 00000i ntf11 intf10 fffffc02h 00h bit position bit name function specify the trigger mode of the intp10 and intp11 pins. intf1n intr1n operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 1, 0 intf1n, intr1n (n = 0, 1) notes 1. the level of the intp1n pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the p1ifn bit (n = 0, 1). consequently, even when the cpu acknowledges the interrupt and the p1ifn bit of the interrupt control register (p1icn) is automatically cleared to 0, the p1ifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intp1n pin of the external device inactive in the interrupt servicing routine, and forcibly clear the p1ifn bit to 0. 2. if a level-detected interrupt request (intp1n) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intp1n) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intp1n) is held pending (n = 0, 1). to not acknowledge the interrupt request of intp1n, clear the p1ifn bit of the interrupt control register.
chapter 7 interrupt/exception proc essing f unction 341 preliminar y user ? s manual u16031ej2v1ud (2) external interrupt rising edge specification register 2 (intr2), external interrupt falling edge specification register 2 (intf2) these registers are used to specify the trigger mode of the external interrupt requests (intp2n) input from external pins and the non-maskable interrupt (nmi) (n = 1 to 5). for the trigger mode of the nmi, see 7.2.4 (1) external interrupt rising edge specification register 2 (intr2), external interrupt falling edge specification register 2 (intf2) . the correspondence between each bit and the external interrupt request and non-maskable interrupt that are controlled by that bit is as follows. ? intf21 and intr21 bits: intp21 ? intf22 and intr22 bits: intp22 ? intf23 and intr23 bits: intp23 ? intf24 and intr24 bits: intp24 ? intf25 and intr25 bits: intp25 the rising edge, falling edge, or both the rising and falling edges can be independently specified as the valid edge of the intp2n pin. each of these registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode of the intp2n pin, set the pmc2 register (n = 1 to 5). if the pmc2 register is set after the intr2 and intf2 registers have been set, an illegal interrupt may occur when the pmc2 register is set.
chapter 7 interrupt/exception proc essing f unction 342 preliminar y user ? s manual u16031ej2v1ud 7 0 intr2 6 0 5 intr25 4 intr24 3 intr23 2 intr22 1 intr21 0 nmir0 address fffffc24h after reset 3fh 0 intf2 0 intf25 intf24 intf23 intf22 intf21 nmif0 fffffc04h 00h bit position bit name function specify the trigger mode of the intp2n pin. intf2n intr2n operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 5 to 1 intf2n, intr2n (n = 1 to 5) notes 1. the level of the intp2n pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the p2ifn bit (n = 1 to 5). consequently, even when the cpu acknowledges the interrupt and the p2ifn bit of the interrupt control register (p2icn) is automatically cleared to 0, the p2ifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intp2n pin of the external device inactive in the interrupt servicing routine, and forcibly clear the p2ifn bit to 0. 2. if a level-detected interrupt request (intp2n) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intp2n) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intp2n) is held pending (n = 1 to 5). to not acknowledge the interrupt request of intp2n, clear the p2ifn bit of the interrupt control register. remark for the bit 0 (nmir0) of the intr2 register and bit 0 (nmif0) of the intf2 register, see 7.2.4 (1) external interrupt rising edge specification register 2 (intr2), external interrupt falling edge specification register 2 (intf2) .
chapter 7 interrupt/exception proc essing f unction 343 preliminar y user ? s manual u16031ej2v1ud (3) external interrupt rising edge specification register 5 (intr5), external interrupt falling edge specification register 5 (intf5) these registers are used to specify the trigger mode of the external interrupt requests (intp5n) input from external pins (n = 0 to 2). the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intf50 and intr50 bits: intp50 ? intf51 and intr51 bits: intp51 ? intf52 and intr52 bits: intp52 the rising edge, falling edge, or both the rising and falling edges can be independently specified as the valid edge. each of these registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode, set the pmc5 register. if the pmc5 register is set after the intr5 and intf5 registers have been set, an illegal interrupt may occur when the pmc5 register is set.
chapter 7 interrupt/exception proc essing f unction 344 preliminar y user ? s manual u16031ej2v1ud 7 0 intr5 6 0 5 0 4 0 3 0 2 intr52 1 intr51 0 intr50 address fffffc2ah after reset 07h 0 intf5 0000i ntf52 intf51 intf50 fffffc0ah 00h bit position bit name function specify the trigger mode of the intp5n pin. intf5n intr5n operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 2 to 0 intf5n, intr5n (n = 0 to 2) notes 1. the level of the intp5n pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the p5ifn bit (n = 0 to 2). consequently, even when the cpu acknowledges the interrupt and the p5ifn bit of the interrupt control register (p5icn) is automatically cleared to 0, the p5ifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intp5n pin of the external device inactive in the interrupt servicing routine, and forcibly clear the p5ifn bit to 0. 2. if a level-detected interrupt request (intp5n) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intp5n) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intp5n) is held pending (n = 0 to 2). to not acknowledge the interrupt request of intp5n, clear the p5ifn bit of the interrupt control register.
chapter 7 interrupt/exception proc essing f unction 345 preliminar y user ? s manual u16031ej2v1ud (4) external interrupt rising edge specification register 6 (intr6), external interrupt falling edge specification register 6 (intf6) these registers are used to specify the trigger mode of the external interrupt requests (intp6n) input from external pins (n = 5 to 7). the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intf65 and intr65 bits: intp65 ? intf66 and intr66 bits: intp66 ? intf67 and intr67 bits: intp67 the rising edge, falling edge, or both the rising and falling edges can be independently specified as the valid edge. each of these registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode, set the pmc6 register. if the pmc6 register is set after the intr6 and intf6 registers have been set, an illegal interrupt may occur when the pmc6 register is set.
chapter 7 interrupt/exception proc essing f unction 346 preliminar y user ? s manual u16031ej2v1ud 7 intr67 intr6 6 intr66 5 intr65 4 0 3 0 2 0 1 0 0 0 address fffffc2ch after reset e0h intf67 intf6 intf66 intf65 00000 fffffc0ch 00h bit position bit name function specify the trigger mode of the intp6n pin. intf6n intr6n operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 7 to 5 intf6n, intr6n (n = 7 to 5) notes 1. the level of the intp6n pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the p6ifn bit (n = 5 to 7). consequently, even when the cpu acknowledges the interrupt and the p6ifn bit of the interrupt control register (p6icn) is automatically cleared to 0, the p6ifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intp6n pin of the external device inactive in the interrupt servicing routine, and forcibly clear the p6ifn bit to 0. 2. if a level-detected interrupt request (intp6n) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intp6n) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intp6n) is held pending (n = 5 to 7). to not acknowledge the interrupt request of intp6n, clear the p6ifn bit of the interrupt control register.
chapter 7 interrupt/exception proc essing f unction 347 preliminar y user ? s manual u16031ej2v1ud (5) external interrupt rising edge specification register al (intral), external interrupt falling edge specification register al (intfal) these registers are used to specify the trigger mode of the external interrupt requests (intpln) input from external pins (n = 0, 1). the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intfal0 and intral0 bits: intpl0 ? intfal1 and intral1 bits: intpl1 the rising edge, falling edge, or both the rising and falling edges can be independently specified as the valid edge. each of these registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode, set the pmcal register. if the pmcal register is set after the intral and intfal registers have been set, an illegal interrupt may occur when the pmcal register is set. 7 0 intral 6 0 5 0 4 0 3 0 2 0 1 intral1 0 intral0 address fffffc30h after reset 03h 0 intfal 00000 intfal1 intfal0 fffffc10h 00h bit position bit name function specify the trigger mode of the intpln pin. intfaln intraln operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 1, 0 intfaln, intraln (n = 0, 1) notes 1. the level of the intpln pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the plifn bit (n = 0, 1). consequently, even when the cpu acknowledges the interrupt and the plifn bit of the interrupt control register (plicn) is automatically cleared to 0, the plifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intpln pin of the external device inactive in the interrupt servicing routine, and forcibly clear the plifn bit to 0. 2. if a level-detected interrupt request (intpln) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intpln) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intpln) is held pending (n = 0, 1). to not acknowledge the interrupt request of intpln, clear the plifn bit of the interrupt control register.
chapter 7 interrupt/exception proc essing f unction 348 preliminar y user ? s manual u16031ej2v1ud (6) external interrupt rising edge specification register dh (intrdh), external interrupt falling edge specification register dh (intfdh) these registers are used to specify the trigger mode of the external interrupt requests (intpdn) input from external pins (n = 0 to 15). the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intfdh0 and intrdh0 bits: intpd0 ? intfdh8 and intrdh8 bits: intpd8 ? intfdh1 and intrdh1 bits: intpd1 ? intfdh9 and intrdh9 bits: intpd9 ? intfdh2 and intrdh2 bits: intpd2 ? intfdh10 and intrdh10 bits: intpd10 ? intfdh3 and intrdh3 bits: intpd3 ? intfdh11 and intrdh11 bits: intpd11 ? intfdh4 and intrdh4 bits: intpd4 ? intfdh12 and intrdh12 bits: intpd12 ? intfdh5 and intrdh5 bits: intpd5 ? intfdh13 and intrdh13 bits: intpd13 ? intfdh6 and intrdh6 bits: intpd6 ? intfdh14 and intrdh14 bits: intpd14 ? intfdh7 and intrdh7 bits: intpd7 ? intfdh15 and intrdh15 bits: intpd15 the rising edge, falling edge, or both the rising and falling edges can be independently specified as the valid edge. the intrdh and intfdh registers can be read or written in 16-bit units. if the higher 8 bits of the intrdh and intfdh registers are used as the intrdhh and intfdhh registers, and the lower 8 bits as the intrdhl and intfdhl registers, these registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode, set the pmcdh register. if the pmcdh register is set after the intrdh and intfdh registers have been set, an illegal interrupt may occur when the pmcdh register is set.
chapter 7 interrupt/exception proc essing f unction 349 preliminar y user ? s manual u16031ej2v1ud 14 intr dh14 13 intr dh13 12 intr dh12 2 intr dh2 3 intr dh3 4 intr dh4 5 intr dh5 6 intr dh6 7 intr dh7 8 intr dh8 9 intr dh9 10 intr dh10 11 intr dh11 15 intr dh15 1 intr dh1 0 intr dh0 intrdh address fffffc36h after reset ffffh intf dh14 intf dh13 intf dh12 intf dh2 intf dh3 intf dh4 intf dh5 intf dh6 intf dh7 intf dh8 intf dh9 intf dh10 intf dh11 intf dh15 intf dh1 intf dh0 intfdh fffffc16h 0000h bit position bit name function specify the trigger mode of the intpdn pin. intfdhn intrdhn operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 15 to 0 intfdhn, intrdhn (n = 0 to 15) notes 1. the level of the intpdn pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the pdifn bit (n = 0 to 15). consequently, even when the cpu acknowledges the interrupt and the pdifn bit of the interrupt control register (pdicn) is automatically cleared to 0, the pdifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intpdn pin of the external device inactive in the interrupt servicing routine, and forcibly clear the pdifn bit to 0. 2. if a level-detected interrupt request (intpdn) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intpdn) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intpdn) is held pending (n = 0 to 15). to not acknowledge the interrupt request of intpdn, clear the pdifn bit of the interrupt control register.
chapter 7 interrupt/exception proc essing f unction 350 preliminar y user ? s manual u16031ej2v1ud (7) valid edge select registers c0 to c3 (sesc0 to sesc3) these registers are used to specify the valid edge of the external interrupt requests (intpc00, intpc01, intpc10, intpc11, intpc20, intpc21, intpc30, intpc31, or tic0 to tic3) input from external pins to tmcn (n = 0 to 3). the rising edge, falling edge, or both the rising and falling edges can be independently specified as the valid edge. each of these registers can be read or written in 8-bit units. be sure to clear bits 5 and 4 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. do not change each bit of the sescn register while the timer is operating (n = 0 to 3). to change a bit, clear the cecn bit of the tmccn0 register to 0. the operation is not guaranteed if the sescn register is rewritten during timer operation. 2. even when the intpc00/tic0, intpc10/tic1, intpc20/tic2, and intpc30/tic3 pins are used as intpc00, intpc10, intpc20, and intpc30, respectively, without using timer c, be sure to set the caecn and cecn bits of timer mode control registers c00 to c03 (tmcc00 to tmcc30) to 1. 3. before setting the trigger mode of the intpc00, intpc01, intpc10, intpc11, intpc20, intpc21, intpc30, intpc31, and tic0 to tic3 pins, set the pmcx register (x = 5 to 7). then set the caecn and cecn bits of the tmccn0 register to 1 (n = 0 to 3). if the pmcx register is set after the sescn register has been set, an illegal interrupt, incorrect count, or incorrect clear may occur depending on the timing of setting the pmcx register (n = 0 to 3, x = 5 to 7).
chapter 7 interrupt/exception proc essing f unction 351 preliminar y user ? s manual u16031ej2v1ud 7 tesc01 tic0 sesc0 6 tesc00 5 0 4 0 3 iesc101 2 iesc100 1 iesc001 0 iesc000 address fffff609h after reset 00h intpc01 intpc00 7 tesc11 tic1 sesc1 6 tesc10 5 0 4 0 3 iesc111 2 iesc110 1 iesc011 0 iesc010 address fffff629h after reset 00h intpc11 intpc10 7 tesc21 tic2 sesc2 6 tesc20 5 0 4 0 3 iesc121 2 iesc120 1 iesc021 0 iesc020 address fffff649h after reset 00h intpc21 intpc20 7 tesc31 tic3 sesc3 6 tesc30 5 0 4 0 3 iesc131 2 iesc130 1 iesc031 0 iesc030 address fffff669h after reset 00h intpc31 intpc30 bit position bit name function specify the valid edge of the intpcm0, intpcm1, and ticm pins (m = 0 to 3). 7, 6 tescn1, tescn0 (n = 0 to 3) xescn1 xescn0 operation 0 0 falling edge 0 1 rising edge 3, 2 iescn1, iescn0 (n = 10 to 13) 1 0 setting prohibited 1 1 both rising and falling edges 1, 0 iescn1, iescn0 (n = 00 to 03)
chapter 7 interrupt/exception proc essing f unction 352 preliminar y user ? s manual u16031ej2v1ud (8) valid edge select registers 10, 11 (sesa10, sesa11) these registers are used to specify the valid edge of the external interrupt requests (tiud10, tiud11, tcud10, tcud11, tclr10, or tclr11) input from external pins and the external capture trigger inputs to timer enc1 (intp100, intp101, intp110, or intp111). the rising edge, falling edge, or both the rising and falling edges can be independently specified as the valid edge. each of these registers can be read or written in 8-bit or 1-bit units. cautions 1. changing each bit of the sesa1n register is prohibited while tmenc1n is operating (ce1n1 bit = 1). 2. before setting the trigger mode of the intp100, intp101, intp110, intp111, tiud10, tiud11, tcud10, tcud11, tclr10, and tclr11 pins, set the pmcdh register. if the pmcdh register is set after the sesa1n register has been set, an illegal interrupt, incorrect count, or incorrect clear may occur depending on the timing of setting the pmcdh register. (1/2) 7 tesud01 sesa10 6 tesud00 5 cesud01 4 cesud00 3 ies101 2 ies100 1 ies001 0 ies000 address fffff5adh after reset 00h tiud10, tcud10 tclr10 intp101 intp100 7 tesud11 sesa11 6 tesud10 5 cesud11 4 cesud10 3 ies111 2 ies110 1 ies011 0 ies010 address fffff5ddh after reset 00h tclr11 tiud11, tcud11 intp111 intp110 bit position bit name function specify the valid edge of the tiud1n and tcud1n pins. tesudn1 tesudn0 valid edge 0 0 falling edge 0 1 rising edge 1 0 setting prohibited 1 1 both rising and falling edges 7, 6 tesudn1, tesudn0 cautions 1. the set values of the tesudn1 and tesudn0 bits are valid only in udc mode a and udc mode b. 2. if mode 4 is specified for the operation of tmenc1n (specified by the prm1n2 to prm1n0 bits of the prm1n register), specifying the valid edge for the tiud1n and tcud1n pins (tesudn1 and tesudn0 bits) is invalid. remark n = 0, 1
chapter 7 interrupt/exception proc essing f unction 353 preliminar y user ? s manual u16031ej2v1ud (2/2) bit position bit name function specify the valid edge of the tclr1n pin. cesudn1 cesudn0 valid edge 0 0 falling edge 0 1 rising edge 10low-level 1 1 high-level 5, 4 cesudn1, cesudn0 the relationship between the set values of the cesudn1 and cesudn0 bits and the operation of tmenc1n is as follows. 00: tmenc1n cleared after the rising edge of tclr1n has been detected. 01: tmenc1n cleared after the falling edge of tclr1n has been detected. 10: tmenc1n stays cleared while tclr1n input is low. 11: tmenc1n stays cleared while tclr1n input is high. caution the set values of the cesudn1 and cesudn0 bits are valid only in udc mode a. specify the valid edge of the intp1n1 pin. ies1n1 ies1n0 valid edge 0 0 falling edge 0 1 rising edge 1 0 setting prohibited 1 1 both rising and falling edges 3, 2 ies1n1, ies1n0 specify the valid edge of the intp1n0 pin. ies0n1 ies0n0 valid edge 0 0 falling edge 0 1 rising edge 1 0 setting prohibited 1 1 both rising and falling edges 1, 0 ies0n1, ies0n0 remark n = 0, 1
chapter 7 interrupt/exception proc essing f unction 354 preliminar y user ? s manual u16031ej2v1ud 7.4 software exception a software exception is generated when the cpu executes the trap instruction, and can always be acknowledged. 7.4.1 operation if a software exception occurs, the cpu performs the following processing, and transfers control to the handler routine: <1> saves the restored pc to eipc. <2> saves the current psw to eipsw. <3> writes an exception code to the lower 16 bits (eicc) of ecr (interrupt source). <4> sets the ep and id bits of the psw. <5> sets the handler address (00000040h or 00000050h) corresponding to the software exception to the pc, and transfers control. figure 7-8 illustrates the processing of a software exception. figure 7-8. software exception processing trap instruction eipc eipsw ecr.eicc psw.ep psw.id pc restored pc psw exception code 1 1 handler address cpu processing exception processing note note trap instruction format: trap vector (the vector is a value from 0 to 1fh.) the handler address is determined by the trap instruction ? s operand (vector). if the vector is 0 to 0fh, it becomes 00000040h, and if the vector is 10h to 1fh, it becomes 00000050h.
chapter 7 interrupt/exception proc essing f unction 355 preliminar y user ? s manual u16031ej2v1ud 7.4.2 restore recovery from software exception processing is carried out by the reti instruction. by executing the reti instruction, the cpu carries out the following processing and shifts control to the restored pc ? s address. <1> loads the restored pc and psw from eipc and eipsw because the ep bit of the psw is 1. <2> transfers control to the address of the restored pc and psw. figure 7-9 illustrates the processing of the reti instruction. figure 7-9. reti instruction processing psw.ep reti instruction pc psw eipc eipsw psw.np original processing restored pc psw fepc fepsw 1 1 0 0 caution when the psw.ep bit and the psw.np bit are changed by the ldsr instruction during the software exception processing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set psw.ep back to 1 using the ldsr instruction immediately before the reti instruction. remark the solid line shows the cpu processing flow.
chapter 7 interrupt/exception proc essing f unction 356 preliminar y user ? s manual u16031ej2v1ud 7.4.3 exception status flag (ep) the ep flag is bit 6 of the psw, and is a status flag used to indicate that exception processing is in progress. it is set when an exception occurs. 31 0 psw after reset 00000020h 7 np 6 ep 5 id 4 sat 3 cy 2 ov 1 sz 8 9 10 11 12 0 0 0 ss 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bit position bit name function 6 ep shows that exception processing is in progress. 0: exception processing not in progress. 1: exception processing in progress.
chapter 7 interrupt/exception proc essing f unction 357 preliminar y user ? s manual u16031ej2v1ud 7.5 exception trap an exception trap is an interrupt that is requested when the illegal execution of an instruction takes place. in the v850e/me2, an illegal opcode exception (ilgop: illegal opcode trap) is considered as an exception trap. 7.5.1 illegal opcode definition the illegal instruction has an opcode (bits 10 to 5) of 111111b, a sub-opcode (bits 26 to 23) of 0111b to 1111b, and a sub-opcode (bit 16) of 0b. an exception trap is generated when an instruction applicable to this illegal instruction is executed. 15 16 23 22 0 1 1 1 1 1 1 27 26 31 0 4 5 10 11 1 1 1 1 1 1 0 1 to : arbitrary caution since it is possible to assign this instruction to an illegal opcode in the future, it is recommended that it not be used. (1) operation if an exception trap occurs, the cpu performs the following processing, and transfers control to the handler routine: <1> saves the restored pc to dbpc. <2> saves the current psw to dbpsw. <3> sets the np, ep, and id bits of the psw. <4> sets the handler address (00000060h) corresponding to the exception trap to the pc, and transfers control. figure 7-10 illustrates the processing of the exception trap.
chapter 7 interrupt/exception proc essing f unction 358 preliminar y user ? s manual u16031ej2v1ud figure 7-10. exception trap processing exception trap (ilgop) occurs dbpc dbpsw psw.np psw.ep psw.id pc restored pc psw 1 1 1 00000060h exception processing cpu processing (2) restore recovery from an exception trap is carried out by the dbret instruction. by executing the dbret instruction, the cpu carries out the following processing and controls the address of the restored pc. <1> loads the restored pc and psw from dbpc and dbpsw. <2> transfers control to the address indicated by the restored pc and psw. figure 7-11 illustrates the restore processing from an exception trap. figure 7-11. restore processing from exception trap dbret instruction pc psw dbpc dbpsw jump to address of restored pc
chapter 7 interrupt/exception proc essing f unction 359 preliminar y user ? s manual u16031ej2v1ud 7.5.2 debug trap the debug trap is an exception that can be acknowledged every time and is generated by execution of the dbtrap instruction. when the debug trap is generated, the cpu performs the following processing. (1) operation <1> saves the restored pc to dbpc. <2> saves the current psw to dbpsw. <3> sets the np, ep and id bits of the psw. <4> sets the handler address (00000060h) corresponding to the debug trap to the pc and transfers control. figure 7-12 illustrates the processing of the debug trap. figure 7-12. debug trap processing dbtrap instruction dbpc dbpsw psw.np psw.ep psw.id pc restored pc psw 1 1 1 00000060h exception processing cpu processing
chapter 7 interrupt/exception proc essing f unction 360 preliminar y user ? s manual u16031ej2v1ud (2) restore recovery from a debug trap is carried out by the dbret instruction. by executing the dbret instruction, the cpu carries out the following processing and controls the address of the restored pc. <1> loads the restored pc and psw from dbpc and dbpsw. <2> transfers control to the address indicated by the restored pc and psw. figure 7-13 illustrates the restore processing from a debug trap. figure 7-13. restore processing from debug trap dbret instruction pc psw dbpc dbpsw jump to address of restored pc
chapter 7 interrupt/exception proc essing f unction 361 preliminar y user ? s manual u16031ej2v1ud 7.6 multiple interrupt servicing control multiple interrupt servicing control is a process by which an interrupt request that is currently being serviced can be interrupted during servicing if there is an interrupt request with a higher priority level, and the higher priority interrupt request is acknowledged and serviced first. if there is an interrupt request with a lower priority level than the interrupt request currently being serviced, that interrupt request is held pending. multiple interrupt servicing control of maskable interrupts is executed when interrupts are enabled (id = 0). thus, to execute multiple interrupts, it is necessary to set the interrupt enabled state (id = 0) even for an interrupt service routine. if maskable interrupts are enabled or a software exception is generated in a maskable interrupt or software exception service program, it is necessary to save eipc and eipsw. this is accomplished by the following procedure. (1) acknowledgment of maskable interrupts in service program service program of maskable interrupt or exception ... ... ? eipc saved to memory or register ? eipsw saved to memory or register ? ei instruction (interrupt acknowledgment enabled) ... ... maskable interrupt acknowledgment ... ... ? di instruction (interrupt acknowledgment disabled) ? saved value restored to eipsw ? saved value restored to eipc ? reti instruction
chapter 7 interrupt/exception proc essing f unction 362 preliminar y user ? s manual u16031ej2v1ud (2) generation of exception in service program service program of maskable interrupt or exception ... ... ? eipc saved to memory or register ? eipsw saved to memory or register ... ? trap instruction exception such as trap instruction acknowledged. ... ? saved value restored to eipsw ? saved value restored to eipc ? reti instruction the priority order for multiple interrupt servicing control has 8 levels, from 0 to 7 for each maskable interrupt request (0 is the highest priority), but it can be set as desired via software. the priority order is set using the xxprn0 to xxprn2 bits of the interrupt control request register (xxlcn), provided for each maskable interrupt request. after system reset, an interrupt request is masked by the xxmkn bit and the priority order is set to level 7 by the xxprn0 to xxprn2 bits. the priority order of maskable interrupts is as follows. (high) level 0 > level 1 > level 2 > level 3 > level 4 > level 5 > level 6 > level 7 (low) interrupt servicing that has been suspended as a result of multiple servicing control is resumed after the servicing of the higher priority interrupt has been completed and the reti instruction has been executed. a pending interrupt request is acknowledged after the current interrupt servicing has been completed and the reti instruction has been executed. caution in a non-maskable interrupt service routine (time until the reti instruction is executed), maskable interrupts are suspended and not acknowledged. remark xx: identification name of each peripheral unit (see table 7-2 ) n: peripheral unit number (see table 7-2 )
chapter 7 interrupt/exception proc essing f unction 363 preliminar y user ? s manual u16031ej2v1ud 7.7 interrupt latency time the v850e/me2 interrupt latency time (from interrupt request generation to start of interrupt servicing) is described below. figure 7-14. pipeline operation at interrupt request acknowledgment (outline) internal clock instruction 1 instruction 2 interrupt acknowledgment operation instruction (start instruction of interrupt service routine) interrupt request if id ex df wb ifx idx 4 system clocks if id ex int1 int2 int3 int4 remark int1 to int4: interrupt acknowledgment processing ifx: invalid instruction fetch idx: invalid instruction decode interrupt latency (internal system clock) external interrupt internal interrupt intpm intpn condition minimum 4 7 + digital delay time 4 + analog delay time maximum 6 note 9 + digital delay time 6 + analog delay time the following cases are exceptions. ? in idle/software stop mode ? external bus access ? two or more interrupt request non-sample instructions are executed in succession ? access to peripheral i/o register note the interrupt latency is the maximum value when executing any of the following instructions. div instruction, prepare instruction, dispose instruction, switch instruction, set1 instruction, clr1 instruction, not1 instruction, ld instruction for internal instruction ram, misalign access remark m = c00, c01, c10, c11, c20, c21, c30, c31 n = 10, 11, 21 to 25, 50 to 52, 65 to 67, l0, l1, d0 to d15
chapter 7 interrupt/exception proc essing f unction 364 preliminar y user ? s manual u16031ej2v1ud 7.8 periods in which interrupts are not acknowledged an interrupt is acknowledged while an instruction is being executed. however, no interrupt will be acknowledged between an interrupt request non-sample instruction and the next instruction (interrupt is held pending). the interrupt request non-sample instructions are as follows. ? ei instruction ? di instruction ? ldsr reg2, 0x5 instruction (for psw) ? the store instruction for the command register (prcmd) ? the load, store, or bit manipulation instructions for the following registers. ? interrupt-related registers: interrupt control register (xxicn), interrupt mask registers 0 to 5 (imr0 to imr5), in-service priority register (ispr), power-save control register (psc)
365 preliminar y user?s manual u16031ej2v1ud chapter 8 clock generation function the clock generator (cg) consists of a spread spectrum frequency synthesizer phase locked loop (sscg) and a divider circuit, and generates and controls the clock supplied to the internal units as well as the cpu. the sscg is a spread spectrum clock generator used to suppress noise, and is effective in reducing the peak value of electromagnetic interference (emi) noise. 8.1 features ? sscg output is used fixed to 8. ? selection of sscg output by pllsel pin set the pllsel pin as follows according to the value of f x = input frequency to x1 and x2 pins (f x ) 8 pllsel pin sscg output (f x ) 0 96 mhz f x 150 mhz 1 80 mhz f x < 96 mhz ? selection of frequency modulation rate (f dit ) of sscg output the following two setting methods are available. ? selection by jit0 and jit1 pins (without modulation (frequency fixed), ? 1%, ? 3%, ? 5%) ? selection by sscgc register (without modulation (frequency fixed), ? 0.5%, ? 1%, ? 2%, ? 3%, ? 4%, ? 5%) ? mdl-selector table (modulation period) selection by sscgc register (13 to 27 khz, 23 to 37 khz, 32 to 48 khz) ? division function by register setting (1/1, 1/2, 1/4, 1/8) ? clock sources oscillation by connecting a resonator ? operation mode selection by register setting the clock to be supplied to each unit is selected from the following by register setting. ? clock output by sscg ? clock from osc without passing through sscg ? usb-dedicated clock input ? power-save control ? halt mode ? idle mode ? software stop mode
chapter 8 clock generation function 366 preliminar y user?s manual u16031ej2v1ud 8.2 configuration divider 1 x1 x2 f x 8 f x f u f clk f x , f x /2, f x /4, f x /8 halt control halt idle control idle idle control idle stop control stop internal system clock osc uck f x main clock clock to peripheral function bus clock (busclk) prescaler selector sscg pll lock (lockup time) divider 2 f usb 48 mhz clock to usb ssel1 ssel0 pllsel jit1 jit0 usb dedicated clock 48 mhz usb clock control register (uckc) clock control register (ckc) bus mode control register (bmc) osts1 osts0 osts2 clock source select register (cks) ckssel oscillation stabilization time select register (osts) ckdiv0 ckdiv1 ckm0 ckm1 lock register (lockr) lock uckcnt remark be sure to set the usb clock to 48 mhz. 8.3 control registers 8.3.1 clock control register (ckc) the clock control register is an 8-bit register that controls the internal system clock (f clk ) in pll mode. it can be written to only by a specific sequence so that it cannot easily be overwritten by mistake due to an inadvertent program loop. this register can be read or written in 8-bit units. be sure to clear bits 7 to 2 to 0. if they are set to 1, the operation is not guaranteed.
chapter 8 clock generation function 367 preliminar y user?s manual u16031ej2v1ud 7 0 ckc 6 0 5 0 4 0 3 0 2 0 1 ckdiv1 0 ckdiv0 address fffff822h after reset 03h bit position bit name function sets the internal system clock (f clk ) when pll mode is used. ckdiv1 ckdiv0 internal system clock (f clk ) 00f x /8 01f x /4 10f x /2 11f x 1, 0 ckdiv1, ckdiv0 to change the internal system clock frequency in the middle of an operation, be sure to set it to f x first, and then change the frequency as desired. remark f x : main clock cautions 1. note that if the internal system clock (f clk ) is changed, the frequency of the bus clock (busclk) is also changed. 2. if it necessary to change the refresh interval of the sdram as a result of changing the internal system clock (f clk ), follow this procedure. <1> mask all interrupts. for how to disable maskable interrupts, refer to the description of interrupt mask registers 0 to 5 (imr0 to imr5) (7.3.5 interrupt mask registers 0 to 5 (imr0 to imr5)). for how to disable non-maskable interrupts, disable multiple interrupts by setting the np bit of the psw to 1 (refer to 3.2.2 (2) program status word (psw)). <2> clear the mea bit of the bctm register to 0 (m = 0, 1, a = 0 to 7). <3> clear the renn bit to 0 (n = 1, 3, 4, or 6). <4> set the mea bit of the bctm register to 1 (m = 0, 1, a = 0 to 7). <5> set a new value to the rccn1, rccn0, and rinn5 to rinn0 bits, and set the renn bit to 1 (n = 1, 3, 4, or 6). <6> write the same value currently set to the scrn register to the scrn register (n = 1, 3, 4, or 6). <7> confirm that the wcfn bit of the scrn register is set to 1, and access sdram (n = 1, 3, 4, or 6). to change the refresh interval, set a value at which refresh can be made in time even while the interval is changed. if the refresh interval is correctly secured, the processing in <1> above may be skipped. the rfsn and bctm registers are prohibited from being rewritten, but they can be rewritten when the refreshing interval is re-set by changing the value of the ckc register. a register write cycle of sdram is generated as a result of rewriting the scrn register (processing in <6> above), but the value of sdram before the rfsn and scrn registers are re-set is retained.
chapter 8 clock generation function 368 preliminar y user ? s manual u16031ej2v1ud set data in the clock control register (ckc) in the following sequence. <1> disable interrupts (set the np bit of psw to 1). <2> prepare data in any one of the general-purpose registers to set in the specific register. <3> write data to the command register (prcmd). <4> set the clock control register (ckc) (with the following instruction). ? store instruction (st/sst instruction) <5> insert the nop instructions (5 instructions (<5> to <9>)). <10> release the interrupt disabled state (clear the np bit of psw to 0). [sample coding] <1> ldsr rx, 5 <2> mov 0x02, r10 <3> st.b r10, prcmd[r0] <4> st.b r10, ckc[r0] <5> nop <6> nop <7> nop <8> nop <9> nop <10> ldsr ry, 5 remark rx: value written to psw ry: value returned to psw no special sequence is required to read the specific register. cautions 1. if an interrupt is acknowledged between the issuance of data to the prcmd (<3>) and writing to the specific register immediately after (<4>), the write operation to the specific register is not performed. therefore, set the np bit of the psw to 1 (<1>) to disable interrupt acknowledgment. also disable interrupt acknowledgment when selecting a bit manipulation instruction for the specific register setting. 2. although the data written to the prcmd register is dummy data, use the same register as the general-purpose register used in specific register setting (<4>) for writing to the prcmd register (<3>). the same method should be applied when using a general-purpose register for addressing. 3. be sure to terminate all dma transfers prior to the execution of the above sequence.
chapter 8 clock generation function 369 preliminar y user?s manual u16031ej2v1ud 8.3.2 clock source select register (cks) this 8-bit register controls supply of the main clock (f x ). it can be written to only by a specific sequence so that it cannot easily be overwritten by mistake due to an inadvertent program loop. this register can be read or written in 8-bit or 1-bit units. cautions 1. with the v850e/me2, it is not assumed that the cpu operates with the osc output always supplied as the main clock (ckssel bit = 0). therefore, be sure to confirm in the initialization sequence that the lock bit of the lockr register is 0, and then supply the main clock from the sscg output (ckssel bit = 1). otherwise, the operation will not be guaranteed. 2. if the software stop mode is released by a non-maskable interrupt request (nmi) or an unmasked maskable interrupt request, the system operates on the sscg output clock after pll frequency stabilization time (about 2 ms) after the count time (oscillation stabilization time set by the osts register) of the time base counter (tbc) has elapsed. therefore, it is not necessary to re-set the cks register. if the software stop mode is released by reset pin input, set the cks register in accordance with the initialization sequence (see 3.4.10 initialization sequence). 7 0 cks 6 0 5 0 4 0 3 0 2 0 1 0 <0> ckssel address fffff82ch after reset 00h bit position bit name function 0 ckssel controls supply of the main clock (f x ). 0: osc output clock (f x ) 1: sscg output clock (f x 8)
chapter 8 clock generation function 370 preliminar y user ? s manual u16031ej2v1ud set data in the clock source select register (cks) in the following sequence. <1> disable interrupts (set the np bit of psw to 1). <2> prepare data in any one of the general-purpose registers to set in the specific register. <3> write data to the command register (prcmd). <4> set the clock source select register (cks) (with the following instruction). ? store instruction (st/sst instruction) <5> insert the nop instructions (5 instructions (<5> to <9>)). <10> release the interrupt disabled state (clear the np bit of psw to 0). [sample coding] <1> ldsr rx, 5 <2> mov 0x01, r10 <3> st.b r10, prcmd[r0] <4> st.b r10, cks[r0] <5> nop <6> nop <7> nop <8> nop <9> nop <10> ldsr ry, 5 remark rx: value written to psw ry: value returned to psw no special sequence is required to read the specific register. cautions 1. if an interrupt is acknowledged between the issuance of data to the prcmd (<3>) and writing to the specific register immediately after (<4>), the write operation to the specific register is not performed. therefore, set the np bit of the psw to 1 (<1>) to disable interrupt acknowledgment. also disable interrupt acknowledgment when selecting a bit manipulation instruction for the specific register setting. 2. although the data written to the prcmd register is dummy data, use the same register as the general-purpose register used in specific register setting (<4>) for writing to the prcmd register (<3>). the same method should be applied when using a general-purpose register for addressing. 3. be sure to terminate all dma transfers prior to the execution of the above sequence.
chapter 8 clock generation function 371 preliminar y user ? s manual u16031ej2v1ud 8.3.3 sscg control register (sscgc) this is an 8-bit register that controls the frequency modulation rate and modulation period of sscg output. it modulates the frequency by the frequency modulation rate (down spread) set by the adj2 to adj0 bits within the modulation period set by the smdln bit. this is effective in reducing the peak value of emi noise. it can be written to only by a specific sequence so that it cannot easily be overwritten by mistake due to an inadvertent program loop. this register can be read or written in 8-bit units. caution the sscgc register can be set only when osc output is supplied as the main clock (ckssel bit of cks register = 0). if the setting of the sscgc register is changed, the sscg is unlocked (lock bit of lockr register = 1). be sure to confirm that the lock bit = 0 before starting to supply sscg output as the main clock (ckssel bit = 1). otherwise, the operation will not be guaranteed. (1/2) 7 0 sscgc 6 0 5 smdl1 4 smdl0 3 adjon 2 adj2 1 adj1 0 adj0 address fffff836h after reset note note the default value is as follows. smdl1 bit = 0, smdl0 bit = 1 the adjon and adj2 to adj0 bits are set as follows by the jit1 and jit0 pins. reset value jit1 pin jit0 pin adjon bit adj2 bit adj1 bit adj0 bit 000000 011001 101011 111101 bit position bit name function set the modulation period of sscg output. smdl1 smdl0 modulation period of sscg output 0 0 13 to 27 khz 0 1 23 to 37 khz 1 0 32 to 48 khz 1 1 setting prohibited 5, 4 smdl1, smdl0
chapter 8 clock generation function 372 preliminar y user?s manual u16031ej2v1ud (2/2) bit position bit name function set the frequency modulation rate of sscg output. frequency modulation rate of sscg output adjon adj2 adj1 adj0 min. typ. max. 0 no modulation (frequency fixed) 1000 ? 0.31% ? 0.50% ? 1.28% 1001 ? 0.67% ? 1.00% ? 1.75% 1010 ? 1.23% ? 2.00% ? 3.10% 1011 ? 1.74% ? 3.00% ? 4.33% 1100 ? 2.48% ? 4.00% ? 5.83% 1101 ? 3.27% ? 5.00% ? 7.28% other than above setting prohibited 3 to 0 adjon, adj2 to adj0 cautions 1. if the frequency modulation rate of sscg output is set to other than ?no modulation (frequency fixed)? (adjon bit = 0), the internal system clock, bus clock (busclk), and clock supplied to the on-chip peripheral functions all operate at the frequency that accords with the frequency modulation rate set by the adj2 to adj0 bits (see 8.5 operating clock provisions). therefore, thoroughly evaluate and confirm the system. 2. an overshoot/undershoot of the frequency modulation rate occurs. set data in the sscg control register (sscgc) in the following sequence. <1> disable interrupts (set the np bit of psw to 1). <2> prepare data in any one of the general-purpose registers to set in the specific register. <3> write data to the command register (prcmd). <4> set the sscg control register (sscgc) (with the following instruction). ? store instruction (st/sst instruction) <5> insert the nop instructions (5 instructions (<5> to <9>)). <10> release the interrupt disabled state (clear the np bit of psw to 0). [sample coding] <1> ldsr rx, 5 <2> mov 0x08, r10 <3> st.b r10, prcmd[r0] <4> st.b r10, sscgc[r0] <5> nop <6> nop <7> nop <8> nop <9> nop <10> ldsr ry, 5
chapter 8 clock generation function 373 preliminar y user ? s manual u16031ej2v1ud remark rx: value written to psw ry: value returned to psw no special sequence is required to read the specific register. cautions 1. if an interrupt is acknowledged between the issuance of data to the prcmd (<3>) and writing to the specific register immediately after (<4>), the write operation to the specific register is not performed. therefore, set the np bit of the psw to 1 (<1>) to disable interrupt acknowledgment. also disable interrupt acknowledgment when selecting a bit manipulation instruction for the specific register setting. 2. although the data written to the prcmd register is dummy data, use the same register as the general-purpose register used in specific register setting (<4>) for writing to the prcmd register (<3>). the same method should be applied when using a general-purpose register for addressing. 3. be sure to terminate all dma transfers prior to the execution of the above sequence. 8.3.4 usb clock control register (uckc) this register is used to select the clock source of the usb clock. be sure to input f usb at 48 mhz. this register can be read or written in 8-bit or 1-bit units. be sure to clear the bits of this register other than bit 7 to 0. if they are set to 1, the operation is not guaranteed. caution when using the usb function, be sure to set (1) the uckcnt bit. if the registers related to the usb function are read while the uckcnt bit is 0, 0 is read. <7> uckcnt uckc 6 0 5 0 4 0 3 0 2 0 1 0 0 0 address fffff82eh after reset 00h bit position bit name function 7 uckcnt controls clock supply to usb. 0: stops clock supply to usb. 1: supplies clock to usb.
chapter 8 clock generation function 374 preliminar y user ? s manual u16031ej2v1ud 8.3.5 lock register (lockr) the lockup time (frequency stabilization time: approx. 2 ms) is the time from when the power is turned on or software stop mode is released until the phase locks at the prescribed frequency. the state until this stabilization occurs is called the lockup state, and the stabilized state is called the locked state. the lock register (lockr) has a lock flag that indicates that the pll is in the lock wait state. this register is read-only in 8-bit or 1-bit units. caution if the phase is locked, the lock flag is cleared to 0. if it is unlocked later because of a standby status, writing to sscgc register, or reset input, the lock flag is set to 1. if the phase is unlocked by a cause other than these, however, the lock flag is not affected (lock = 0). 7 0 lockr 6 0 5 0 4 0 3 0 2 0 1 0 <0> lock address fffff824h after reset 01h bit position bit name function 0 lock this is a read-only flag that indicates the pll lock wait state. this flag holds the value 0 as long as a lockup state is maintained. 0: indicates that the pll is locked. 1: indicates that the pll is waiting to be locked (unlock state). if some other factor operates to cause an unlock state to occur, for control processing that depends on software execution speed, such as real-time processing, be sure to judge the lock flag by software immediately after operation begins and start processing after the pll is locked. on the other hand, static processing such as the setting of internal hardware or the initialization of register data or memory data can be executed without waiting for the lock flag to be reset to 0.
chapter 8 clock generation function 375 preliminar y user ? s manual u16031ej2v1ud 8.3.6 oscillation stabilization time select register (osts) this is an 8-bit register that specifies the oscillation stabilization time. the osts register is used to make sure that the oscillation stabilization time of the oscillator elapses when the software stop mode is released. after the software stop mode is released, the oscillation stabilization time is counted by the time base counter (tbc), and program execution is started about 2 ms later. this register can be read or written in 8-bit units. 7 0 osts 6 0 5 0 4 0 3 0 2 osts2 1 osts1 0 osts0 address fffff6c0h after reset 04h bit position bit name function specify the oscillation stabilization time. osts2 osts1 osts0 oscillation stabilization time 000f x /2 13 001f x /2 15 010f x /2 16 011f x /2 17 100f x /2 18 101f x /2 19 110f x /2 20 111f x /2 21 2 to 0 osts2 to osts0 remark f x : osc output clock
chapter 8 clock generation function 376 preliminar y user ? s manual u16031ej2v1ud 8.4 operation 8.4.1 operation status of each clock the following table shows the operation status of each clock. table 8-1. operation status of each clock main clock (f x ) clock source osc pll clock supply to on-chip peripheral function internal system clock (f clk ) usb clock (f usb ) busclk normal operation ????? halt mode ???? idle mode ?? software stop mode oscillation stabilization period ?? note 1 note 1 pll mode reset period ? note 2 note 2 remark : operates : stops notes 1. the system operates on the osc output clock at power application. it stops when the operation is restored from the software stop mode by an interrupt. 2. operates on the osc output clock. 8.4.2 setting of input clock (f x ) this table lists the frequencies supplied to the v850e/me2. table 8-2. frequency list multiple pllsel pin ssel1 pin ssel0 pin input frequency (mhz) (target values) main clock (f x ) frequency (mhz) 0 1 setting prohibited setting prohibited 1 0 10.00 to 10.19 80.00 to 81.59 1 1 1 10.20 to 11.99 81.60 to 95.99 0 0 12.00 to 14.39 96.00 to 115.19 0 1 14.40 to 17.39 115.20 to 139.19 1 0 17.40 to 18.75 139.20 to 150.00 8 0 1 1 setting prohibited setting prohibited caution the max. value of f clk of a 100 mhz version is 100 mhz, that of a 133 mhz version is 133 mhz, and that of a 150 mhz version is 150 mhz. the operation is not guaranteed if f clk (max.) < f x . make sure that f x does not exceed the guaranteed operating frequency of each product.
chapter 8 clock generation function 377 preliminar y user?s manual u16031ej2v1ud 8.5 operating clock provisions sscg consists of a multiplier that multiplies the osc clock by eight and a modulation circuit for frequency diffusion. the multiplier that multiplies the osc clock generates an output error of up to 150 ps in the output period because of its circuit characteristics. the modulation circuit adds the modulation error with respect to the set modulation rate, which varies depending on the modulation rate. therefore, the output frequency (f clk ) of busclk, which outputs a clock via sscg, and the operating frequency of the on-chip peripheral i/o (main clock (f x ) of timers c, d, and enc1, pwm unit, csi3, uartb, and a/d converter) are affected by this error. when calculating the frequency of each signal, therefore, be sure to take this error into consideration. the methods of calculating the output period and output frequency at each modulation rate are shown below. (1) minimum value of operating frequency (f min ) modulation rate of sscg output (%) parameter output period: t max (ns) output frequency (mhz) no modulation 1.00000 (1/f x ) 10 3 + 0.15 (1/t max ) 10 3 ? 0.50 0.99890 {1/(0.99110 f x )} 10 3 +0.15 (1/t max ) 10 3 ? 1.00 0.99375 {1/(0.98625 f x )} 10 3 + 0.15 (1/t max ) 10 3 ? 2.00 0.98550 {1/(0.97450 f x )} 10 3 + 0.15 (1/t max ) 10 3 ? 3.00 0.97665 {1/(0.96335 f x )} 10 3 + 0.15 (1/t max ) 10 3 ? 4.00 0.96915 {1/(0.95085 f x )} 10 3 + 0.15 (1/t max ) 10 3 ? 5.00 0.96140 {1(0.93860 f x )} 10 3 + 0.15 (1/t max ) 10 3 (2) maximum value of operating frequency (f max ) modulation rate of sscg output (%) parameter output period: t max (ns) output frequency (mhz) no modulation 1.00000 (1/f x ) 10 3 ? 0.15 (1/t min ) 10 3 ? 0.50 1.00390 {1/(1.00390 f x )} 10 3 ? 0.15 (1/t min ) 10 3 ? 1.00 1.00375 {1/(1.00375 f x )} 10 3 ? 0.15 (1/t min ) 10 3 ? 2.00 1.00550 {1/(1.00550 f x )} 10 3 ? 0.15 (1/t min ) 10 3 ? 3.00 1.00665 {1/(1.00665 f x )} 10 3 ? 0.15 (1/t min ) 10 3 ? 4.00 1.00915 {1/(1.00915 f x )} 10 3 ? 0.15 (1/t min ) 10 3 ? 5.00 1.01140 {1/(1.01140 f x )} 10 3 ? 0.15 (1/t min ) 10 3 (3) average operating frequency (f ave ) the average operating frequency can be calculated by this expression. average operating frequency (f ave ) = (f min + f max )/2 the average operating frequency is in one period of the modulation period set by the smdl1 and smdl0 bits of the sscgc register. the average operating frequency in a period shorter than the modulation period may have a relatively larger error than the result of the above expression.
chapter 8 clock generation function 378 preliminar y user?s manual u16031ej2v1ud 8.5.1 calculating busclk frequency if the modulation function of sscg is used, the internal system clock frequency (f clk ) from which busclk is generated fluctuates. exercise care in calculating the frequency of busclk. the following table shows the frequency fluctuation of busclk. table 8-3. frequency fluctuation of busclk bmc register busclk frequency (mhz) ckm1 ckm1 min. typ. max. 00f min f ave f max 01f min /2 f ave /2 f max /2 10f min /3 f ave /3 f max /3 11f min /4 f ave /4 f max /4 8.5.2 calculating operating clock frequency of each on-chip peripheral function when the modulation function of sscg is used, the main clock (f x ) from which the operating clock of each on-chip peripheral function is generated fluctuates. note (1) to (8) below. (1) count period of timer c: period of count clock frequency (set by the cscn2 to cscn0 bits of the tmccn0 register) when input clock is specified (eticn bit of the tmccn1 register = 0) (n = 0 to 5) the count period can be calculated from the average operating frequency. however, the average operating frequency is in one period of the modulation period set by the smdl1 and smdl0 bits of the sscgc register. note that the average operating frequency may have a relatively larger error than the result of calculation during a count operation in a period shorter than the modulation period. if it is necessary to guarantee an absolute value for the count operation, it is recommended to set appropriate counts during operation at f min if the counting operation is performed within a specific time and during operation at f max if the operation is performed for longer than a specific time. do not use the modulation function of sscg if a high-accuracy count operation is necessary. (2) count period of timer d: period of count clock frequency (set by csdn2 to csdn0 bits of the tmcdn register) (n = 0 to 3) the count period can be calculated from the average operating frequency. however, the average operating frequency is in one period of the modulation period set by the smdl1 and smdl0 bits of the sscgc register. note that the average operating frequency may have a relatively larger error than the result of calculation during a count operation in a period shorter than the modulation period. if it is necessary to guarantee an absolute value for the count operation, it is recommended to set appropriate counts during operation at f min if the counting operation is performed within a specific time and during operation at f max if the operation is performed for longer than a specific time. do not use the modulation function of sscg if a high-accuracy count operation is necessary.
chapter 8 clock generation function 379 preliminar y user?s manual u16031ej2v1ud (3) count period of timer enc1: period of count clock frequency (set by prm1n2 to prm1n0 bits of the prm1n register) when general- purpose timer mode is specified (t1cmdn bit of the tum1n register = 0) (n = 0, 1) the count period can be calculated from the average operating frequency. however, the average operating frequency is in one period of the modulation period set by the smdl1 and smdl0 bits of the sscgc register. note that the average operating frequency may have a relatively larger error than the result of calculation during a count operation in a period shorter than the modulation period. if it is necessary to guarantee an absolute value for the count operation, it is recommended to set appropriate counts during operation at f min if the counting operation is performed within a specific time and during operation at f max if the operation is performed for longer than a specific time. duty setting is guaranteed during either high level output or low level output when pwm output is performed. do not use the modulation function of sscg if a high-accuracy count operation is necessary. (4) pulse output period of pwm unit: period of operating clock frequency (set by the ckspn1 and ckspn0 bits of the pwmcn register) (n = 0, 1) the pulse output period can be calculated from the average operating frequency. however, the average operating frequency is in one period of the modulation period set by the smdl1 and smdl0 bits of the sscgc register. note that the average operating frequency may have a relatively larger error than the result of calculation when a pulse with a period shorter than the modulation period is output. if it is necessary to guarantee an absolute value for the pulse output, it is recommended to set appropriate counts during operation at f min if the counting operation is performed within a specific time and during operation at f max if the operation is performed for longer than a specific time. duty setting is guaranteed during either high level output or low level output when pwm output is performed. do not use the modulation function of sscg if a high-accuracy pulse output is necessary. (5) serial communication (transmission, reception, or transmission/reception) transfer rate of csi3: period of base clock frequency (cks3n2 to cks3n0 of the csic3n register = other than 111) (n = 0, 1) with master mode specified the transfer rate can be calculated from the average operating frequency. however, the average operating frequency is in one period of the modulation period set by the smdl1 and smdl0 bits of the sscgc register. note that the average operating frequency may have a relatively larger error than the result of calculation at a transfer rate shorter than the modulation period. if it is necessary to guarantee an absolute value for the transfer rate, it is recommended to set an appropriate transfer rate during operation at f min for the minimum transfer rate and during operation at f max for the maximum transfer rate.
chapter 8 clock generation function 380 preliminar y user?s manual u16031ej2v1ud (6) serial communication (transmission or reception) transfer rate of uartb: period of serial transfer speed (set by the ubnbrs15 to ubnbrs0 bits of the ubnctl2 register) (n = 0, 1) set the value of the transfer rate (set value (k) of the ubnctl2 register) so that the permissible maximum and minimum baud rate errors are satisfied at both f min and f max . here is a calculation example. <1> determine the set value (k) of the ubnctl2 register from the calculation result of the expression ?target baud rate 2/f ave (hz)?. <2> calculate the actual baud rate value at f max and f min , by using the set value (k) calculated in <1> above. <3> check that the result of calculation in <2> above satisfies the allowable maximum/minimum baud rate error. <4> from <1> to <3>, calculate the set value of the transfer rate (set value (k) of the ubnctl2 register). caution change the modulation rate of sscg if the set value (set value (k) of the ubnctl2 register) of the transfer rate that satisfies the above calculation method cannot be obtained. (example) f x = 150 mhz: setting of modulation rates of 4% and 5% is prohibited. f x = 133 mhz: setting of modulation rates of 4% and 5% is prohibited. f x = 100 mhz: setting of modulation rate of 5% is prohibited. (7) a/d converter: conversion time calculate the set value (2 to 10 s) of the a/d conversion time (set by the fr3 to fr0 bits of the adm1 register) by f ave (calculation by f min and f max is not necessary). (8) digital noise elimination time calculate the minimum noise elimination time set by the ncwcn and ncw1m registers at f max and the maximum noise elimination time at f min (n = 0 to 3, m = 0, 1).
chapter 8 clock generation function 381 preliminar y user ? s manual u16031ej2v1ud 8.6 power-save control 8.6.1 overview the power-save function has the following three modes. (1) halt mode in this mode, the clock generator (oscillator (osc, sscg) and pll synthesizer) continues to operate, but the cpu ? s operation clock stops. since the supply of clocks to on-chip peripheral functions other than the cpu continues, operation continues. the power consumption of the overall system can be reduced by intermittent operation using a combination of the halt mode and the normal operation mode. the system is switched to halt mode by a specific instruction (the halt instruction). (2) idle mode in this mode, the clock generator (oscillator (osc, sscg) and pll synthesizer) continues to operate, but the supply of internal system clocks is stopped, which causes the overall system to stop. when the system is released from idle mode, it can be switched to normal operation mode quickly because the oscillator ? s oscillation stabilization time does not need to be secured. the system is switched to idle mode by a psmr register setting. idle mode is located midway between software stop mode and halt mode in relation to the clock stabilization time and current consumption. it is used for situations in which a low-current-consumption mode is to be used and the clock stabilization time is to be eliminated after the mode is released. (3) software stop mode in this mode, the overall system is stopped by stopping the clock generator (oscillator (osc, sscg) and pll synthesizer). the system enters an ultra-low-power-consumption state in which only leakage current is lost. the system is switched to software stop mode by a psmr register setting. the pll synthesizer ? s clock output is stopped at the same time the oscillator is stopped. after software stop mode is released by reset input, the oscillator ? s oscillation stabilization time must be secured until the system clock stabilizes. when the software stop mode is released by the non-maskable interrupt request (nmi) or an unmasked maskable interrupt request, program execution is started about 2 ms after the count time of the time base counter (tbc) elapses.
chapter 8 clock generation function 382 preliminar y user ? s manual u16031ej2v1ud figure 8-1 shows the operation of the clock generator in normal operation mode, halt mode, idle mode, and software stop mode. an effective low power consumption system can be realized by combining these modes and switching modes according to the required use. figure 8-1. power-save mode state transition diagram normal operation mode software stop mode set stop mode release according to interrupt request note 1 idle mode set idle mode set halt mode halt mode release according to reset release according to reset or interrupt note 3 release according to reset or interrupt request note 2 wait for oscillation stabilization + wait for pll lockup notes 1. non-maskable interrupt request (nmi), unmasked external maskable interrupt request note 4 , or unmasked internal maskable interrupt request note 5 of peripheral function that can operate in software stop mode 2. non-maskable interrupt request (nmi), unmasked external maskable interrupt request note 4 , or unmasked internal maskable interrupt request note 5 of peripheral function that can operate in idle mode 3. non-maskable interrupt request (nmi) or unmasked maskable interrupt request 4. intpn (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, l1) when level detection is specified for the intpn pin, software stop mode and idle mode cannot be released. 5. intrsum
chapter 8 clock generation function 383 preliminar y user ? s manual u16031ej2v1ud 8.6.2 control registers (1) power-save mode register (psmr) this is an 8-bit register that controls power-save mode. it is effective only when the stp bit of the psc register is set to 1. writing to the psmr register is executed by the store instruction (st/sst instruction) and a bit manipulation instruction (set1/clr1/not1 instruction). this register can be read or written in 8-bit or 1-bit units. be sure to clear bits 7, 5, and 4 to 0. if they are set to 1, the operation is not guaranteed. 7 0 psmr 6 0 5 0 4 0 3 0 2 0 1 0 psm address fffff820h after reset 00h <0> bit position bit name function 0 psm specifies idle mode or software stop mode. 0: switches the system to idle mode 1: switches the system to software stop mode (2) command register (prcmd) this is an 8-bit register that is used to set protection for write operations to registers that can significantly affect the system so that the application system is not halted unexpectedly due to an inadvertent program loop. writing to the first specific register (power-save control register (psc), etc.) is only valid after first writing to the prcmd register. because of this, the register value can be overwritten only by the specified sequence, preventing an illegal write operation from being performed. this register is write-only in 8-bit units (when it is read, undefined data is read out). 7 rreg7 prcmd 6 rreg6 5 rreg5 4 rreg4 3 rreg3 2 rreg2 1 rreg1 0 rreg0 address fffff1fch after reset undefined bit position bit name function 7 to 0 rreg7 to rreg0 registration code (arbitrary 8-bit data) the specific register targeted is as follows. ? power-save control register (psc) ? clock control register (ckc) ? clock source select register (cks) ? sscg control register (sscgc)
chapter 8 clock generation function 384 preliminar y user ? s manual u16031ej2v1ud (3) power-save control register (psc) this is an 8-bit register that controls the power-save function. if interrupts are enabled by the setting of the nmim and intm bits, the software stop mode can be released by an interrupt request (except when interrupt servicing is disabled by the interrupt mask registers (imr0 to imr5)). the software stop mode is specified by the setting of the stp bit. this register, which is one of the specific registers, is valid only when accessed in a specific sequence during a write operation. this register can be read or written in 8-bit or 1-bit units. be sure to clear bits 7 and 6 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. it is impossible to set the stp bit and the nmim or intm bit at the same time. be sure to set the stp bit after setting the nmim or intm bit. 2. the software stop mode is not released by an interrupt request for which the nmim and intm bits are set to 1 because this interrupt request is invalid (it is not held pending). 7 0 psc 6 0 nmim intm 3 0 2 0 stp 0 0 address fffff1feh after reset 00h <1> <4> <5> bit position bit name function 5 nmim this is the enable/disable setting bit for standby mode release using the valid edge input of nmi. 0: release by nmi enabled 1: release by nmi disabled 4 intm this is the enable/disable setting for standby mode release using an unmasked maskable interrupt (intpn) (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, l1). 0: release by maskable interrupt enabled 1: release by maskable interrupt disabled 1stp indicates the standby mode status. if 1 is written to this bit, the system enters idle or software stop mode (set by the psm bit of the psmr register). when standby mode is released, this bit is automatically reset to 0. 0: standby mode is released 1: standby mode is in effect set data in the power-save control register (psc) in the following sequence. <1> set the power-save mode register (psmr) (with the following instructions). ? store instruction (st/sst instruction) ? bit manipulation instruction (set1/clr1/not1 instruction) <2> prepare data in any one of the general-purpose registers to set to the specific register. <3> write data to the command register (prcmd). <4> set the power-save control register (psc) (with the following instructions). ? store instruction (st/sst instruction) ? bit manipulation instruction (set1/clr1/not1 instruction) <5> insert the nop instructions (5 instructions (<5> to <9>).
chapter 8 clock generation function 385 preliminar y user ? s manual u16031ej2v1ud sample coding <1> st.b r11, psmr[r0] ; set psmr register <2> mov 0x02, r10 <3> st.b r10, prcmd[r0] ; write prcmd register <4> st.b r10, psc[r0] ; set psc register <5> nop ; dummy instruction <6> nop ; dummy instruction <7> nop ; dummy instruction <8> nop ; dummy instruction <9> nop ; dummy instruction (next instruction) ; execution routine after software stop mode and idle mode release no special sequence is required to read the specific register. cautions 1. a store instruction for the command register does not acknowledge interrupts. this coding is made on assumption that <3> and <4> above are executed by the program with consecutive store instructions. if another instruction is set between <3> and <4>, the above sequence may become ineffective when the interrupt is acknowledged by that instruction, and a malfunction of the program may result. 2. although the data written to the prcmd register is dummy data, use the same register as the general-purpose register used in specific register setting (<4>) for writing to the prcmd register (<3>). the same method should be applied when using a general-purpose register for addressing. 3. at least 5 nop instructions must be inserted after executing a store instruction to the psc register to set software stop or idle mode. 4. be sure to terminate all dma transfers prior to the execution of the above sequence.
chapter 8 clock generation function 386 preliminar y user ? s manual u16031ej2v1ud 8.6.3 halt mode (1) setting and operation status in halt mode, the clock generator (oscillator (osc, sscg) and pll synthesizer) continues to operate, but the operation clock of the cpu is stopped. since the supply of clocks to on-chip peripheral functions other than the cpu continues, operation continues. the power consumption of the overall system can be reduced by setting the system to halt mode while the cpu is idle. the system is switched to halt mode by the halt instruction. although program execution stops in halt mode, the contents of all registers, internal data ram, internal instruction ram, and ports are maintained in the state they were in immediately before halt mode began. also, operation continues for all on-chip peripheral functions (other than ports) that do not depend on cpu instruction processing. the following shows the status of each hardware unit in halt mode. cautions 1. if the halt instruction is executed while an interrupt is being held pending, the halt mode is set once but it is immediately released by the pending interrupt request. 2. at least 5 nop instructions must be inserted after executing a halt instruction.
chapter 8 clock generation function 387 preliminar y user ? s manual u16031ej2v1ud table 8-4. operation status in halt mode function operation status clock generator operating main clock (f x ) operating cpu stopped internal data all internal data such as cpu registers, statuses, data, and the contents of internal data ram and internal instruction ram are maintained in the state they were in immediately before halt mode began. dmac operating intc operating tmc0 to tmc5 operating tmd0 to tmd3 operating tmenc10, tmenc11 operating uartb0, uartb1 operating csi30, csi31 operating a/d converter operating ports maintained the state before halt mode set usb function controller operating d0 to d31 a0 to a25 rd, we/wr, bcyst ulwr, uuwr, llwr, luwr, iord, iowr lldqm, ludqm, uldqm, uudqm llbe, lube, ulbe, uube cs0 to cs7 sdras sdcas refrq hldak hldrq wait selfref sdcke operating busclk clock output
chapter 8 clock generation function 388 preliminar y user ? s manual u16031ej2v1ud (2) release of halt mode halt mode is released by a non-maskable interrupt request, an unmasked maskable interrupt request, or reset pin input. (a) release according to a non-maskable interrupt request or an unmasked maskable interrupt request halt mode is released by a non-maskable interrupt request or by an unmasked maskable interrupt request regardless of the priority. the operation after release is as follows. table 8-5. operation after halt mode is released by interrupt request release source enable interrupt (ei) status disable interrupt (di) status non-maskable interrupt request branch to handler address maskable interrupt request branch to handler address or execute next instruction execute next instruction however, if the system is set to halt mode during an interrupt servicing routine, operation will differ as follows. (i) if an interrupt request is generated with a lower priority than that of the maskable interrupt request that is currently being serviced, halt mode is released, but the newly generated interrupt request is not acknowledged. the new interrupt request is held pending. (ii) if an interrupt request (including non-maskable interrupt requests) is generated with a higher priority than that of the maskable interrupt request that is currently being serviced, halt mode is released and the newly generated interrupt request is acknowledged. (b) release according to reset pin input this is the same as a normal reset operation. the busclk operation when the halt mode is released is illustrated below.
chapter 8 clock generation function 389 preliminar y user ? s manual u16031ej2v1ud figure 8-2. busclk operation when halt mode is released (a) when halt mode is released by non-maskable interrupt request or unmasked external maskable interrupt request power supply voltage h osc output clock (f x ) osc output stabilized f x = f x 8 (sscg output), sscg output stabilized (lock = 0) internal system clock interrupt request busclk <1> remarks 1. <1>: interrupt signal (active) input 2. busclk is output normally in the halt mode. (b) when halt mode is released by reset pin input power supply voltage h osc output clock (f x ) osc output stabilized pll lockup time (2 ms or more) f x = f x 8 (sscg output) f x = f x (osc output) sscg output stabilized (lock = 0) internal system clock reset (input) busclk <1> <2> <3> <4> <5> remarks 1. <1>: reset input <2>: reset cleared (counting pll lockup time starts) <3>: pll lock status (lock bit of lockr register = 0) <4>: busclk = f clk /2 (ckm1 and ckm0 bits of bmc register = 01) <5>: f x = f x 8 (ckssel bit of cks register = 1) 2. the above operation is performed if busclk operates with half the period of the internal system clock (f clk ).
chapter 8 clock generation function 390 preliminar y user ? s manual u16031ej2v1ud 8.6.4 idle mode (1) setting and operation status in this mode, the entire system is stopped with the clock generator (oscillator (osc, sscg) and pll synthesizer) continuing to operate and clock supply to the cpu and other on-chip peripheral functions stopped. when idle mode is released, the system can be switched to normal operation mode quickly because the oscillator ? s oscillation stabilization time or the pll lockup time does not need to be secured. the system is switched to idle mode by setting the psc or psmr register using a store instruction (st or sst instruction) or a bit manipulation instruction (set1, clr1, or not1 instruction) (see 8.6.2 control registers ). in idle mode, program execution is stopped, and the contents of all registers, internal data ram, internal instruction ram, and ports are maintained in the state they were in immediately before execution stopped. the operation of cpu and other on-chip peripheral functions is stopped. however, the on-chip peripheral functions that can operate on the external clock continue operating. the following shows the status of each hardware unit in idle mode. caution insert at least 5 nop instructions after the instruction that stores data in the psc register to set the idle mode.
chapter 8 clock generation function 391 preliminar y user ? s manual u16031ej2v1ud table 8-6. operation status in idle mode function operation status clock generator operating main clock (f x ) stopped cpu stopped internal data all internal data such as cpu registers, statuses, data, and the contents of internal data ram and internal instruction ram are maintained in the state they were in immediately before idle mode began. dmac stopped intc stopped tmc0 to tmc5 stopped tmd0 to tmd3 stopped tmenc10, tmenc11 stopped uartb0, uartb1 stopped csi30, csi31 stopped a/d converter stopped ports maintained the state before idle mode set usb function controller stopped (resume signal can only be received) d0 to d31 a0 to a25 high impedance rd, we/wr, bcyst ulwr, uuwr, llwr, luwr, iord, iowr lldqm, ludqm, uldqm, uudqm llbe, lube, ulbe, uube cs0 to cs7 high-level output sdras sdcas self-refresh status when connected to sdram refrq operating (outputs high level when sdram controller is not used) hldak high-level output hldrq wait selfref input (no sampling) sdcke low-level output (outputs high level when sdram controller is not used) busclk low-level output
chapter 8 clock generation function 392 preliminar y user ? s manual u16031ej2v1ud (2) release of idle mode the idle mode is released by a non-maskable interrupt request, an unmasked external maskable interrupt request (intpn) note , an unmasked internal maskable interrupt request of a peripheral function that can operate in the idle mode (intrsum), and reset pin input (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, or l1). note when level detection is set, the idle mode cannot be released. (a) release according to a non-maskable interrupt request or an unmasked maskable interrupt request idle mode can be released by an interrupt request only when it has been set with the intm and nmim bits of the psc register cleared to 0. idle mode is released by a non-maskable interrupt request, an unmasked external maskable interrupt request (intpn), or an unmasked internal maskable interrupt request of a peripheral function that can operate in the idle mode (intrsum) regardless of the priority (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, or l1). the operation after release is as follows. table 8-7. operation after idle mode is released by interrupt request release source enable interrupt (ei) status disable interrupt (di) status non-maskable interrupt request branch to handler address maskable interrupt request branch to handler address or execute next instruction execute next instruction however, if the system is set to idle mode during an interrupt servicing routine, operation will differ as follows. (i) if an interrupt request is generated with a lower priority than that of the maskable interrupt request that is currently being serviced, idle mode is released, but the newly generated interrupt request is not acknowledged. the new interrupt request is held pending. (ii) if an interrupt request (including non-maskable interrupt requests) is generated with a higher priority than that of the maskable interrupt request that is currently being serviced, idle mode is released and the newly generated interrupt request is acknowledged. if the system is set to idle mode during an nmi servicing routine, idle mode is released, but the interrupt is not acknowledged (interrupt is held pending). interrupt servicing that is started when idle mode is released by nmi pin input is handled in the same way as normal nmi interrupt servicing that occurs during an emergency (because the nmi interrupt handler address is unique). therefore, when a program must be able to distinguish between these two situations, a software status must be prepared in advance and that status must be set before setting the psmr register using a store instruction or a bit manipulation instruction. by checking for this status during nmi interrupt servicing, an ordinary nmi can be distinguished from the processing that is started when idle mode is released by nmi pin input. (b) release according to reset pin input this is the same as a normal reset operation.
chapter 8 clock generation function 393 preliminar y user ? s manual u16031ej2v1ud the busclk operation when the idle mode is released is illustrated below. figure 8-3. busclk operation when idle mode is released (a) when idle mode is released by non-maskable interrupt request or unmasked external maskable interrupt request power supply voltage h osc output clock (f x ) internal system clock interrupt request busclk osc output stabilized f x = f x 8 (sscg output), sscg output stabilized (lock = 0) <1> remark <1>: interrupt signal (active) input (b) when idle mode is released by reset pin input power supply voltage h osc output clock (f x ) osc output stabilized pll lockup time (2 ms or more) f x = f x 8 (sscg output) f x = f x (osc output) sscg output stabilized (lock = 0) internal system clock reset (input) busclk <1> <2> <3> <4> <5> remarks 1. <1>: reset input <2>: reset cleared (counting pll lockup time starts) <3>: pll lock status (lock bit of lockr register = 0) <4>: busclk = f clk /2 (ckm1 and ckm0 bits of bmc register = 01) <5>: f x = f x 8 (ckssel bit of cks register = 1) 2. the above operation is performed if busclk operates with half the period of the internal system clock (f clk ).
chapter 8 clock generation function 394 preliminar y user ? s manual u16031ej2v1ud 8.6.5 software stop mode (1) setting and operation status in software stop mode, the clock generator (oscillator (osc, sscg) and pll synthesizer) is stopped. the overall system is stopped, and ultra-low power consumption is achieved in which only leakage current is lost. the system is switched to software stop mode by using a store instruction (st or sst instruction) or bit manipulation instruction (set1, clr1, or not1 instruction) to set the psc and psmr registers (see 8.6.2 control registers ). the oscillator ? s oscillation stabilization time and pll frequency stabilization time must be secured after software stop mode is released. if the software stop mode is released by an unmasked maskable interrupt request note , program execution is started after the pll lockup time (about 2 ms) has elapsed after the count time of the time base counter (tbc) (time set by the osts register) elapses. although program execution stops in software stop mode, the contents of all registers, internal data ram, internal instruction ram, and ports are maintained in the state they were in immediately before software stop mode began. the operation of cpu and other on-chip peripheral functions is stopped. the following shows the status of each hardware unit in software stop mode. note intp10, intp11, intp21 to intp25, intp50 to intp52, intp65 to intp67, intpd0 to intpd15, intpl0, intpl1, intrsum cautions 1. insert at least 5 nop instructions after the instruction that stores data in the psc register to set the software stop mode. 2. if the software stop mode is released by an unmasked maskable interrupt request, the external bus continues to operate in the same status as in the software stop mode during the count time (time set by the osts register) of the time base counter (tbc) and the pll lockup time.
chapter 8 clock generation function 395 preliminar y user ? s manual u16031ej2v1ud table 8-8. operation status in software stop mode function operation status clock generator stopped main clock (f x ) stopped cpu stopped internal data all internal data such as cpu registers, statuses, data, and the contents of internal data ram and internal instruction ram are maintained in the state they were in immediately before software stop mode began. dmac stopped intc stopped tmc0 to tmc5 stopped tmd0 to tmd3 stopped tmenc10, tmenc11 stopped uartb0, uartb1 stopped csi30, csi31 stopped a/d converter stopped ports maintained the state before software stop mode set usb function controller stopped (resume signal can only be received) d0 to d31 a0 to a25 high impedance rd, we/wr, bcyst ulwr, uuwr, llwr, luwr, iord, iowr lldqm, ludqm, uldqm, uudqm llbe, lube, ulbe, uube cs0 to cs7 high-level output sdras sdcas self-refresh status when connected to sdram refrq operating (outputs high level when sdram controller is not used) hldak high-level output hldrq wait selfref input (no sampling) sdcke low-level output (outputs high level when sdram controller is not used) busclk low-level output
chapter 8 clock generation function 396 preliminar y user ? s manual u16031ej2v1ud (2) release of software stop mode the software stop mode is released by a non-maskable interrupt input, an unmasked external maskable interrupt request (intpn) note , an unmasked internal maskable interrupt request of a peripheral function that can operate in the software stop mode (intrsum), or reset pin input (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, or l1). when the software stop mode is released by reset pin input, it is necessary to make sure that the oscillation stabilization time of the oscillator elapses. when the software stop mode is released by the non-maskable interrupt or an unmasked maskable interrupt request, program execution starts after about 2 ms after the count time of the time base counter (tbc) elapses. note when level detection is set, the software stop mode cannot be released. (a) release according to a non-maskable interrupt request or an unmasked maskable interrupt request the software stop mode can be released by an interrupt request only when it has been set with the intm and nmim bits of the pcs register cleared to 0. software stop mode is released by a non-maskable interrupt request, an unmasked external maskable interrupt request (intpn), or an unmasked internal maskable interrupt request of a peripheral function that can operate in the software stop mode (intrsum) regardless of the priority (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, or l1). the operation after release is as follows. table 8-9. operation after software stop mode is released by interrupt request release source enable interrupt (ei) status disable interrupt (di) status non-maskable interrupt request branch to handler address maskable interrupt request branch to handler address or execute next instruction execute next instruction the operation is performed as shown below if the software stop mode is set in an interrupt servicing routine.
chapter 8 clock generation function 397 preliminar y user ? s manual u16031ej2v1ud table 8-10. operation if software stop mode is set in interrupt servicing routine releasing cause type of interrupt servicing routine when software stop mode is set releasing source priority note 1 operation low same high (id = 1) note 2 only software stop mode is released and interrupt request is not acknowledged (is held pending). maskable interrupt request high (id = 0) note 3 maskable interrupt non-maskable interrupt request ? interrupt request is acknowledged when software stop mode is released. maskable interrupt request ? low same only software stop mode is released and interrupt request is not acknowledged (is held pending). non-maskable interrupt non-maskable interrupt request high interrupt request is acknowledged when software stop mode is released. notes 1. priority of interrupt (being serviced) when software stop mode is set 2. when the id bit of the psw is 1 (disabling acknowledging interrupt) 3. when the id bit of the psw is 0 (enabling acknowledging interrupt) remark the software stop mode is released by nmi regardless of the value of the np bit of the psw. if the system is set to software stop mode during an nmi servicing routine, software stop mode is released, but the interrupt is not acknowledged (interrupt is held pending). interrupt servicing that is started when software stop mode is released by nmi pin input is handled in the same way as normal nmi interrupt servicing that occurs during an emergency (because the nmi interrupt handler address is unique). therefore, when a program must be able to distinguish between these two situations, a software status must be prepared in advance and that status must be set before setting the psmr register using a store instruction or a bit manipulation instruction. by checking for this status during nmi interrupt servicing, an ordinary nmi can be distinguished from the servicing that is started when software stop mode is released by nmi pin input. (b) release according to reset pin input this is the same as a normal reset operation. the busclk operation when the software stop mode is released is illustrated below.
chapter 8 clock generation function 398 preliminar y user ? s manual u16031ej2v1ud figure 8-4. busclk operation when software stop mode is released (1/2) (a) when software stop mode is released by non-maskable interrupt request or unmasked external maskable interrupt request power supply voltage h osc output clock (f x ) osc output stabilized osc output undefined oscillation stabilization time pll lockup time (2 ms or more) f x = f x 8 (sscg output), sscg output stabilized (lock = 0) internal system clock interrupt request busclk <1> <2> <3> remark <1>: interrupt signal (active) input (counting the oscillation stabilization time starts) <2>: osc output oscillation stabilization (counting of the oscillation stabilization time/pll lockup time starts) <3>: operation starts in the status before the software stop mode is set after the pll lock status (counting the pll lockup time ends)
chapter 8 clock generation function 399 preliminar y user ? s manual u16031ej2v1ud figure 8-4. busclk operation when software stop mode is released (2/2) (b) when software stop mode is released by reset pin input power supply voltage h osc output clock (f x ) osc output undefined osc output stabilized pll lockup time (2 ms or more) secure oscillation stabilization time f x = f x 8 (sscg output) f x = f x (osc output) sscg output stabilized (lock = 0) internal system clock reset (input) busclk <1> <2> <3> <4> <5> <6> remarks 1. <1>: reset input <2>: osc output oscillation stabilization <3>: reset cleared (counting pll lockup time starts) <4>: pll lock status (lock bit of lockr register = 0) <5>: busclk = f clk /2 (ckm1 and ckm0 bits of bmc register = 01) <6>: f x = f x 8 (ckssel bit of cks register = 1) 2. the above operation is performed if busclk operates with half the period of the internal system clock (f clk ).
chapter 8 clock generation function 400 preliminar y user ? s manual u16031ej2v1ud 8.7 securing oscillation stabilization time 8.7.1 oscillation stabilization time security specification when the software stop mode is released by a non-maskable interrupt request, an unmasked external maskable interrupt request (intpn) note (n = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, or l1), or an unmasked internal maskable interrupt request of a peripheral function that can operate in the software stop mode (intrsum), the oscillation stabilization time set by the osts register is secured (see figure 8-4 (a) ). about 2 ms after that, program execution is started. when the software stop mode is released by reset pin input, the oscillation stabilization time does not elapse. therefore, secure the oscillation stabilization time by the low-active width of reset (see figure 8-4 (b) ). the internal time base counter (tbc) is used as a timer that counts and secures the oscillation stabilization time. oscillation stabilization time = count time of tbc note when level detection is set, the software stop mode cannot be released. 8.7.2 time base counter (tbc) the time base counter (tbc) is used to secure the oscillator ? s oscillation stabilization time when software stop mode is released. the tbc counts the oscillation stabilization time after software stop mode is released, and program execution begins after the count is completed. the tbc count clock is selected according to the osts2 to osts0 bits of the osts register, and the next counting time can be set. table 8-11. counting time examples counting time osts2 to osts0 bits oscillation stabilization time f x = 16.6 mhz f x = 12.5 mhz 000 f x /2 13 0.49 ms 0.66 ms 001 f x /2 15 1.97 ms 2.62 ms 010 f x /2 16 3.95 ms 5.24 ms 011 f x /2 17 7.90 ms 10.49 ms 100 f x /2 18 15.79 ms 20.97 ms 101 f x /2 19 31.58 ms 41.94 ms 110 f x /2 20 63.17 ms 83.89 ms 111 f x /2 21 126.33 ms 167.77 ms remark f x : osc output clock
401 preliminar y user?s manual u16031ej2v1ud chapter 9 timer/counter function (real-time pulse unit) 9.1 timer c 9.1.1 features timer c is a 16-bit timer/counter that can perform the following operations. ? interval timer function ? pwm output ? external signal cycle measurement 9.1.2 function overview ? 16-bit timer/counter: 6 channels (no capture operation for 2 channels) ? capture/compare common registers: 12 sources ? interrupt request sources ? capture/match interrupt requests: 12 sources capture register: generates intcccm0 or intcccm1 at intpcm0 or intpcm1 input compare register: generates intcccn0 or intcccn1 at match signal of cccn0 or cccn1 ? overflow interrupt requests: 6 sources ? timer/counter count clock sources: 2 types (selection of external pulse input or main clock division) ? either free-running mode or overflow stop mode can be selected as the operation mode when the timer/counter overflows ? timer/counter can be cleared by a match of the timer/counter and a compare register ? external pulse outputs: 6 remark m = 0 to 3, n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user?s manual u16031ej2v1ud 402 9.1.3 basic configuration table 9-1. timer c configuration timer count clock register read/write generated interrupt signal capture trigger timer output s/r other functions tmc0 read intovc0 ? ? ccc00 read/write intccc00 intpc00 toc0 (s) ccc01 read/write intccc01 intpc01 toc0 (r) tmc1 read intovc1 ? ? ccc10 read/write intccc10 intpc10 toc1 (s) ccc11 read/write intccc11 intpc11 toc1 (r) tmc2 read intovc2 ? ? ccc20 read/write intccc20 intpc20 toc2 (s) ccc21 read/write intccc21 intpc21 toc2 (r) tmc3 read intovc3 ? ? ccc30 read/write intccc30 intpc30 toc3 (s) ccc31 read/write intccc31 intpc31 toc3 (r) tmc4 read intovc4 ? ? ccc40 read/write intccc40 ? toc4 (s) a/d conversion start trigger ccc41 read/write intccc41 ? toc4 (r) a/d conversion start trigger tmc5 read intovc5 ? ? ccc50 read/write intccc50 ? toc5 (s) a/d conversion start trigger timer c f x /8, f x /16, f x /32, f x /64, f x /128, f x /256, f x /512, f x /1,024 ccc51 read/write intccc51 ? toc5 (r) a/d conversion start trigger remark f x : main clock s/r: set/reset
chapter 9 timer/counter function (real-time pulse unit) preliminary user?s manual u16031ej2v1ud 403 (1) timer c (16-bit timer/counter) figure 9-1. timer c block diagram r note q sq tmcn (16 bits) cccn0 cccn1 intovcn intcccn0 intpcm1 1/2 1/4 1/8 1/16 1/32 1/64 1/128 1/256 f x /4 ticm/intpcm0 intcmd0 of tmd0 intcccn1 tocn clear & start selector selector selector selector edge detector edge detector edge detector noise filter noise filter ncccn1 ncccn0 noise elimination width setting register cn (ncwcn) internal bus note reset priority remarks 1. m = 0 to 3, n = 0 to 5 2. f x : main clock
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 404 9.1.4 timer c (1) timers c0 to c5 (tmc0 to tmc5) tmcn functions as a 16-bit free-running timer or as an event counter for an external signal. besides being mainly used for cycle measurement, tmcn can be used as pulse output (n = 0 to 5). tmcn is read-only in 16-bit units. cautions 1. the tmcn register can only be read. if the tmcn register is written, the subsequent operation is undefined. 2. if the caecn bit of the tmccn0 register is cleared to 0, a reset is performed asynchronously. tmc1 fffff620h 0000h tmc2 fffff640h 0000h 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 tmc0 fffff600h 0000h address after reset 0 tmc4 fffff680h 0000h tmc5 fffff6a0h 0000h tmc3 fffff660h 0000h tmcn performs the count-up operations of an internal count clock or external count clock. timer start and stop are controlled by the cecn bit of timer mode control register cn0 (tmccn0) (n = 0 to 5). the internal or external count clock is selected by the eticn bit of timer mode control register cn1 (tmccn1) (n = 0 to 5).
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 405 (a) selection of the external count clock tmcn operates as an event counter. when the eticn bit of timer mode control register cn1 (tmccn1) is set to 1, tmcm counts the valid edges of the external clock input (ticm), synchronized with the internal count clock. the valid edge is specified by valid edge select register cm (sescm) (m = 0 to 3, n = 0 to 5). caution when the intpcm0/ticm pin is used as ticm (external clock input pin), disable the intpcm0 interrupt or set cccm0 to compare mode (m = 0 to 3, n = 0 to 5). (b) selection of the internal count clock tmcn operates as a free-running timer. when an internal clock is specified as the count clock by timer mode control register cn1 (tmccn1), tmcn is counted up for each input clock cycle specified by the cscn0 to cscn2 bits of the tmccn0 register (n = 0 to 5). division by the prescaler can be selected for the count clock from among f x /8, f x /16, f x /32, f x /64, f x /128, f x /256, f x /512, and f x /1,024 by the tmccn0 register (f x : main clock). an overflow interrupt can be generated if the timer overflows. also, the timer can be stopped following an overflow by setting the ostcn bit of the tmccn1 register to 1. caution the count clock cannot be changed while the timer is operating. the conditions when the tmcn register becomes 0000h are shown below. (a) asynchronous reset ? caecn bit of tmccn0 register = 0 ? reset input (b) synchronous reset ? cecn bit of tmccn0 register = 0 ? the cccn0 register is used as a compare register, and the tmcn and cccn0 registers match when clearing the tmcn register is enabled (cclrcn bit of the tmccn1 register = 1)
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 406 (2) capture/compare registers cn0 and cn1 (cccn0 and cccn1) (n = 0 to 5) these capture/compare registers (cn0 and cn1) are 16-bit registers. they can be used as capture registers or compare registers according to the cmscn0 and cmscn1 bit specifications of timer mode control register cn1 (tmccn1) (n = 0 to 5). these registers can be read or written in 16-bit units. (however, write operations can only be performed in compare mode.) caution the ccc40, ccc41, ccc50, and ccc51 registers can only be used as compare registers. they cannot be used as capture registers. ccc1n ccc2n 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ccc0n fffff602h, fffff604h fffff622h, fffff624h fffff642h, fffff644h fffff662h, fffff664h 0000h 0000h 0000h 0000h address after reset 0 ccc4n ccc5n fffff682h, fffff684h fffff6a2h, fffff6a4h 0000h 0000h ccc3n remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 407 (a) setting these registers as capture registers (cmscn0 and cmscn1 of tmccn1 = 0) when these registers are set as capture registers, the valid edges of the corresponding external interrupt signals intpcm0 and intpcm1 are detected as capture triggers. the timer tmcm is synchronized with the capture trigger, and the value of tmcm is latched in the cccm0 and cccm1 registers (capture operation) (m = 0 to 3, n = 0 to 5). the valid edge of the intpcm0 pin is specified (rising edge, falling edge, or both rising and falling edges) according to the iesc0m1 and iesc0m0 bits of the sescm register, and the valid edge of the intpcm1 pin is specified according to the iesc1m1 and iesc1m0 bits of the sescm register. the capture operation is performed asynchronously to the count clock. the latched value is held in the capture register until another capture operation is performed. when the caecn bit of timer mode control register cn0 (tmccn0) is 0, 0000h is read. if these registers are specified as capture registers, an interrupt is generated by detecting the valid edge of signals intpcm0 and intpcm1. caution if the capture operation contends with the timing of disabling the tmcm register from counting (when the cecn bit of the tmccn0 register = 0), the captured data becomes undefined. in addition, the intcccm0 and intcccm1 interrupts do not occur (m = 0 to 3, n = 0 to 5). (b) setting these registers as compare registers (cmscn0 and cmscn1 of tmccn1 = 1) when these registers are set as compare registers, the tmcn and register values are compared for each count clock, and an interrupt is generated by a match. if the cclrcn bit of timer mode control register cn1 (tmccn1) is set to 1, the tmcn value is cleared to 0 at the same time as a match with the cccn0 register (it is not cleared to 0 by a match with the cccn1 register) (n = 0 to 5). a compare register is equipped with a set/reset function. the corresponding timer output (tocn) is set or reset, in synchronization with the generation of a match signal. the interrupt selection source differs according to the function of the selected register. cautions 1. to write to capture/compare registers cn0 and cn1, always set the caecn bit to 1 first. if the caecn bit is 0, the data that is written will be invalid. 2. write to capture/compare registers cn0 and cn1 after setting them as compare registers via tmccn0 and tmccn1 register settings. if they are set as capture registers (cmscn0 and cmscn1 bits of tmccn1 register = 0), no data is written even if a write operation is performed to cccm0 and cccm1 (m = 0 to 3, n = 0 to 5). 3. when these registers are set as compare registers, intpcn0 and intpcn1 cannot be used (n = 0 to 5). when using these registers as an external interrupt input pin, use the intp65 and intp66 pins.
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 408 9.1.5 control registers (1) timer mode control registers c00 to c50 (tmcc00 to tmcc50) the tmccn0 registers control the operation of tmcn (n = 0 to 5). these registers can be read or written in 8-bit or 1-bit units. be sure to clear bits 3 and 2 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. the caecn and other bits cannot be set at the same time. the other bits and the registers of the other tmcn unit should always be set after the caecn bit has been set. also, to use external pins related to the timer function when timer c is used, be sure to set the caecn bit to 1 after setting the external pins to control mode. 2. when conflict occurs between an overflow and a tmccn0 register write, the ovfcn bit value becomes the value written during the tmccn0 register write (n = 0 to 5). (1/2) ovfc0 ovfc1 ovfc2 ovfc3 tmcc00 tmcc10 tmcc20 tmcc30 6 csc02 csc12 csc22 csc32 5 csc01 csc11 csc21 csc31 4 csc00 csc10 csc20 csc30 3 0 0 0 0 2 0 0 0 0 cec0 cec1 cec2 cec3 caec0 caec1 caec2 caec3 address fffff606h fffff626h fffff646h fffff666h after reset 00h 00h 00h 00h <1> <7> <0> ovfc4 ovfc5 tmcc40 tmcc50 csc42 csc52 csc41 csc51 csc40 csc50 0 0 0 0 cec4 cec5 caec4 caec5 fffff686h fffff6a6h 00h 00h bit position bit name function 7 ovfcn this is a flag that indicates tmcn overflow. 0: no overflow occurs 1: overflow occurs when tmcn has counted up from ffffh to 0000h, the ovfcn bit becomes 1 and an overflow interrupt request (intovcn) is generated at the same time. however, if tmcn is cleared to 0000h after a match at ffffh when the cccn0 register is set to compare mode (cmscn0 bit of tmccn1 register = 1) and clearing is enabled for a match when tmcn and cccn0 are compared (cclrcn bit of tmccn1 register = 1), then tmcn is considered to be cleared and the ovfcn bit does not become 1. also, no intovcn interrupt is generated. the ovfcn bit retains the value 1 until 0 is written directly or until an asynchronous reset is performed because the caecn bit is 0. an interrupt operation due to an overflow is independent of the ovfcn bit, and the interrupt request flag (ovcifn) for intovcn is not affected even if the ovfcn bit is manipulated. if an overflow occurs while the ovfcn bit is being read, the flag value changes, and the change is reflected when the next read operation occurs. remark n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 409 (2/2) bit position bit name function selects the tmcn internal count clock. cscn2 cscn1 cscn0 count cycle 000f x /8 001f x /16 010f x /32 011f x /64 100f x /128 101f x /256 110f x /512 111f x /1,024 6 to 4 cscn2 to cscn0 caution the cscn2 to cscn0 bits must not be changed during timer operation. if they are to be changed, they must be changed after setting the cecn bit to 0. if these bits are overwritten during timer operation, operation cannot be guaranteed. remark f x : main clock 1cecn controls the operation of tmcn. 0: count disabled (stops at 0000h and does not operate) 1: counting operation is performed caution when cecn = 0, the external pulse output (tocn) becomes inactive (the active level of tocn output is set by the alvcn bit of the tmccn1 register). 0 caecn controls the internal count clock. 0: the entire tmcn unit is asynchronously reset. the supply of clocks to the tmcn unit stops. 1: clocks are supplied to the tmcn unit cautions 1. when the caecn bit is cleared to 0, the tmcn unit can be asynchronously reset. 2. when caecn = 0, the tmcn unit is in a reset state. therefore, to operate tmcn, the caecn bit must be set to 1. 3. when the caecn bit is changed from 1 to 0, all registers of the tmcn unit are initialized. when caecn is set to 1 again, the tmcn unit registers must be set again. remark n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 410 (2) timer mode control registers c01 to c51 (tmcc01 to tmcc51) the tmccn1 registers control the operation of tmcn (n = 0 to 5). these registers can be read or written in 8-bit units. cautions 1. the various bits of the tmccn1 register must not be changed during timer operation. if they are to be changed, they must be changed after setting the cecn bit of the tmccn0 register to 0. if these bits are overwritten during timer operation, operation cannot be guaranteed (n = 0 to 5). 2. if the entocn and alvcn bits are changed at the same time, a glitch (spike shaped noise) may be generated in the tocn pin output. either create a circuit configuration that will not malfunction even if a glitch is generated or make sure that the entocn and alvcn bits do not change at the same time (n = 0 to 5). 3. tocn output is not changed by an external interrupt signal (intpcm0 or intpcm1). to use the tocn signal, specify that the capture/compare registers are compare registers (cmscn0 and cmscn1 bits of tmccn1 register = 1) (m = 0 to 3, n = 0 to 5). 4. the tmcc41 and tmcc51 registers can be used only when the ccc40, ccc41, ccc50, and ccc51 registers are used as compare registers. they cannot be used when the ccc40, ccc41, ccc50, and ccc51 registers are used as capture registers. 5. to clear the external interrupt signal by setting the eclrcn bit, be sure to make the following setting. count clock period of tmd0 > count clock period of tmcn if this setting is not made, the falling edge of the intcmd0 interrupt signal may not be detected. correct example (if count clock of tmd0 is slow) csd02 to csd00 bits of tmcd0 register = 011: f x /64 cscn2 to cscn0 bits of tmcc0 register = 001: f x /16 remark resetting the flip-flop of the tocn output takes precedence (n = 0 to 5).
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 411 (1/2) 7 ostc0 ostc1 ostc2 ostc3 ostc4 ostc5 tmcc01 tmcc11 tmcc21 tmcc31 tmcc41 tmcc51 6 entoc0 entoc1 entoc2 entoc3 entoc4 entoc5 5 alvc0 alvc1 alvc2 alvc3 alvc4 alvc5 4 etic0 etic1 etic2 etic3 etic4 etic5 3 cclrc0 cclrc1 cclrc2 cclrc3 cclrc4 cclrc5 2 eclrc0 eclrc1 eclrc2 eclrc3 eclrc4 eclrc5 1 cmsc01 cmsc11 cmsc21 cmsc31 cmsc41 cmsc51 0 cmsc00 cmsc10 cmsc20 cmsc30 cmsc40 cmsc50 address fffff608h fffff628h fffff648h fffff668h fffff688h fffff6a8h after reset 20h 20h 20h 20h 20h 20h bit position bit name function 7 ostcn sets the operation when tmcn has overflowed. 0: after the overflow, counting continues (free-running mode) 1: after the overflow, the timer maintains the value 0000h, and counting stops (overflow stop mode). counting is resumed by the following operation. when eclrcn bit = 0: writing 1 to cecn bit when eclrcn bit = 1: inputting valid edge to intcmd0 6 entocn external pulse output is enabled/disabled (tocn). 0: external pulse output is disabled. output of the alvcn bit inactive level to the tocn pin is fixed. the tocn pin level is not changed even if a match signal from the corresponding compare register is generated. 1: external pulse output is enabled. a compare register match causes tocn output to change. however, if capture mode is set, tocn output does not change. the alvcn bit inactive level is output from the time when timer output is enabled until a match signal is first generated. caution if either cccn0 or cccn1 is specified as a capture register, the entocn bit must be cleared to 0. 5 alvcn specifies the active level for external pulse output (tocn). 0: active level is low level 1: active level is high level caution the initial value of the alvcn bit is 1. 4 eticn specifies a switch between the external and internal count clock. 0: specifies the input clock (internal). the count clock can be selected according to the cscn2 to cscn0 bits of tmccn0. 1: specifies the external clock (ticm). the valid edge can be selected according to the tescm1 and tescm0 bit specifications of sescm. remark m = 0 to 3 n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 412 (2/2) bit position bit name function 3 cclrcn sets whether the clearing of tmcn is enabled or disabled during a compare operation. 0: clearing is disabled 1: clearing is enabled (if cccn0 and tmcn match during a compare operation, tmcn is cleared) 2 eclrcn enables/disables clearing tmcn by intcmd0 (tmd0). 0: disables clearing by intcmd0. 1: enables clearing by intcmd0. after tmcn has been cleared, it resumes counting. caution when eclrcn = 1, unless a compare match interrupt (intcmd0) is generated by tmd0, timer counting does not start (even if the cecn bit of the tmccn0 register is set (1)). 1cmscn1 selects the operation mode of the capture/compare register (cccn1). 0: the register operates as a capture register (cccm1) 1: the register operates as a compare register (cccn1) 0 cmscn0 selects the operation mode of the capture/compare register (cccn0). 0: the register operates as a capture register (cccm0) 1: the register operates as a compare register (cccn0) remark m = 0 to 3 n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 413 (3) valid edge select registers c0 to c3 (sesc0 to sesc3) these registers specify the valid edge of an external interrupt request (intpc00, intpc01, intpc10, intpc11, intpc20, intpc21, intpc30, intpc31, and tic0 to tic3) from an external pin of tmcn (n = 0 to 3). the rising edge, the falling edge, or both rising and falling edges can be specified as the valid edge independently for each pin. each of these registers can be read or written in 8-bit units. be sure to clear bits 5 and 4 to 0. if they are set to 1, the operation is not guaranteed. cautions 1. the various bits of the sescn register must not be changed during timer operation (n = 0 to 3). if they are to be changed, they must be changed after setting the cecn bit of the tmccn0 register to 0. if the sescn register is overwritten during timer operation, operation cannot be guaranteed. 2. even when using the intpc00/tic0, intpc10/tic1, intpc20/tic2, and intpc30/tic3 pins as intpc00, intpc10, intpc20, and intpc30, respectively, without using timer c, be sure to set the caecn and cecn bits of timer mode control registers c00 to c03 (tmcc00 to tmcc30) to 1. 3. before setting the trigger mode of the inptc00, intpc01, intpc10, intpc11, intpc20, intpc21, intpc30, intpc31, and tic0 to tic3 pins, set the pmcx register (x = 5 to 7). then set the caecn and cecn bits of the tmccn0 register to 1 (n = 0 to 3). if the pmcx register is set after the sescn register has been set, an illegal interrupt, incorrect counting, and incorrect clearing may occur depending on the timing of setting the pmcx register (n = 0 to 3, x = 5 to 7).
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 414 7 tesc01 tic0 sesc0 6 tesc00 5 0 4 0 3 iesc101 2 iesc100 1 iesc001 0 iesc000 address fffff609h after reset 00h intpc01 intpc00 7 tesc11 tic1 sesc1 6 tesc10 5 0 4 0 3 iesc111 2 iesc110 1 iesc011 0 iesc010 address fffff629h after reset 00h intpc11 intpc10 7 tesc21 tic2 sesc2 6 tesc20 5 0 4 0 3 iesc121 2 iesc120 1 iesc021 0 iesc020 address fffff649h after reset 00h intpc21 intpc20 7 tesc31 tic3 sesc3 6 tesc30 5 0 4 0 3 iesc131 2 iesc130 1 iesc031 0 iesc030 address fffff669h after reset 00h intpc31 intpc30 bit position bit name function specifies the valid edge of the intpcm0, intpcm1, and ticm pins (m = 0 to 3). 7, 6 tescn1, tescn0 (n = 0 to 3) xescn1 xescn0 operation 0 0 falling edge 0 1 rising edge 3, 2 iescn1, iescn0 (n = 10 to 13) 1 0 setting prohibited 1 1 both rising and falling edges 1, 0 iescn1, iescn0 (n = 00 to 03)
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 415 (4) noise elimination width setting registers c0 to c3 (ncwc0 to ncwc3) the ncwcn registers are used to set the noise elimination width of the digital noise filter of the timer c input pin (n = 0 to 3). these registers can be read or written in 8-bit units. be sure to clear bits 7 to 2 to 0. if they are set to 1, the operation is not guaranteed. 7 0 0 0 0 ncwc0 ncwc1 ncwc2 ncwc3 6 0 0 0 0 5 0 0 0 0 4 0 0 0 0 3 0 0 0 0 2 0 0 0 0 1 nccc01 nccc11 nccc21 nccc31 0 nccc00 nccc10 nccc20 nccc30 address fffff610h fffff630h fffff650h fffff670h after reset 02h 02h 02h 02h bit position bit name function specifies the number of clocks by which noise is to be eliminated. ncccn1 ncccn0 number of clocks by which noise is to be eliminated 0 0 0 (through input) 012 103 115 1, 0 ncccn1, ncccn0 remark 1 clock = f x /4 f x : main clock remark n = 0 to 3
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 416 9.1.6 operation (1) count operation timer c can function as a 16-bit free-running timer or as an external signal event counter. the setting for the type of operation is specified by timer mode control registers cn0 and cn1 (tmccn0 and tmccn1) (n = 0 to 5). when it operates as a free-running timer, if the cccn0 or cccn1 register and the tmcn count value match, an interrupt signal is generated and the timer output signal (tocn) can be set or reset. also, a capture operation that holds the tmcm count value in the cccm0 or cccm1 register is performed, in synchronization with the valid edge that was detected from the external interrupt request input pin as an external trigger (m = 0 to 3). the capture value is held until the next capture trigger is generated. caution when using the intpcm0/ticm0 pin as ticm0 (external clock input pin), be sure to disable the intpcm0 interrupt or set the cccm0 register to compare mode (m = 0 to 3). figure 9-2. basic operation of timer c 0001h 0000h 0002h 0003h fbfeh fbffh 0001h 0002h 0000h tmcn count clock ? count disabled cecn 0 ? count start cecn 1 ? count start cecn 1 remark n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 417 (2) overflow when the tmcn register has counted the count clock from ffffh to 0000h, the ovfcn bit of the tmccn0 register is set to 1, and an overflow interrupt (intovcn) is generated at the same time. however, if the cccn0 register is set to compare mode (cmscn0 bit = 1) and to the value ffffh when match clearing is enabled (cclrcn bit = 1), then the tmcn register is considered to be cleared and the ovfcn bit is not set to 1 when the tmcn register changes from ffffh to 0000h. also, the overflow interrupt (intovcn) is not generated . when the tmcn register is changed from ffffh to 0000h because the cecn bit changes from 1 to 0, the tmcn register is considered to be cleared, but the ovfcn bit is not set to 1 and no intovcn interrupt is generated. also, timer operation can be stopped after an overflow by setting the ostcn bit of the tmccn1 register to 1. when the timer is stopped due to an overflow, the count operation is not restarted until the cecn bit of the tmccn0 register is set to 1. operation is not affected even if the cecn bit is set to 1 during a count operation. remark n = 0 to 5 figure 9-3. operation after overflow (when ostcn = 1) overflow count start overflow ffffh ffffh tmcn 0 intovcn ostcn 1 cecn 1 cecn 1 remark n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 418 (3) capture operation the tmcn register has two capture/compare registers. these are the cccn0 register and the cccn1 register. a capture operation or a compare operation is performed according to the settings of both the cmscn1 and cmscn0 bits of the tmccn1 register. if the cmscn1 and cmscn0 bits of the tmccn1 register are cleared to 0, the register operates as a capture register. a capture operation that captures and holds the tmcm count value asynchronously relative to the count clock is performed in synchronization with an external trigger. the valid edge that is detected from an external interrupt request input pin (intpcm0 or intpcm1) is used as an external trigger (capture trigger). the tmcm count value during counting is captured and held in the capture register, in synchronization with that capture trigger signal. the capture register value is held until the next capture trigger is generated. also, an interrupt request (intcccm0 or intcccm1) is generated by intpcm0 or intpcm1 signal input. the valid edge of the capture trigger is set by valid edge select register cm (sescm). if both the rising and falling edges are set as capture triggers, the input pulse width from an external source can be measured. also, if only one of the edges is set as the capture trigger, the input pulse cycle can be measured. remark m = 0 to 3 n = 0 to 5 figure 9-4. capture operation example tmc1 0 cec1 intpc11 ccc11 (capture register) n n (capture trigger) (capture trigger) remarks 1. when the cec1 bit is 0, no capture operation is performed even if intpc11 is input. 2. valid edge of intpc11: rising edge
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 419 figure 9-5. tmc1 capture operation example (when both edges are specified) tmc1 ? count start cec1 1 ? overflow ovfc1 1 d0 d1 d2 d0 d1 d2 interrupt request (intpc11) (tmc1 count values) capture register (ccc11) remark d0 to d2: tmc1 count values
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 420 (4) compare operation the tmcn register has two capture/compare registers. these are the cccn0 register and the cccn1 register. a capture operation or a compare operation is performed according to the settings of both the cmscn1 and cmscn0 bits of the tmccn1 register. if the cmscn1 and cmscn0 bits of the tmccn1 register are set to 1, the register operates as a compare register. a compare operation that compares the value that was set in the compare register and the tmcn count value is performed. if the tmcn count value matches the value of the compare register, which had been set in advance, a match signal is sent to the output controller. the match signal causes the timer output pin (tocn) to change and an interrupt request signal (intcccn0 or intcccn1) to be generated at the same time. if the cccn0 or cccn1 registers are cleared to 0000h, the 0000h after the tmcn register counts up from ffffh to 0000h is judged as a match. in this case, the tmcn register value is cleared to 0 at the next count timing, however, this 0000h is not judged as a match. also, the 0000h when the tmcn register begins counting is not judged as a match. if match clearing is enabled (cclrcn bit = 1) for the cccn0 register, the tmcn register is cleared when a match with the tmcn register occurs during a compare operation. remark n = 0 to 5 figure 9-6. compare operation example (1/2) (a) when cclrc0 bit = 1 and ccc00 is other than 0000h 0001h tmc0 count-up 0000h n n n ? 1 compare register (ccc00) toc0 (output) match detection (intccc00) remarks 1. the match is detected immediately after the count-up, and the match detection signal is generated. 2. n 0000h
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 421 figure 9-6. compare operation example (2/2) (b) when cclrc0 bit = 1 and ccc00 is 0000h 0001h tmc0 count-up 0000h 0000h 0000h ffffh compare register (ccc00) intovc0 toc0 (output) match detection (intccc00) remark the match is detected immediately after the count-up, and the match detection signal is generated.
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 422 (5) external pulse output timer c has six timer output pins (tocn). an external pulse output (tocn) is generated when a match of the two compare registers (cccn0 and cccn1) and the tmcn register is detected. if a match is detected when the tmcn count value and the cccn0 value are compared, the output level of the tocn pin is set. also, if a match is detected when the tmcn count value and the cccn1 value are compared, the output level of the tocn pin is reset. the output level of the tocn pin can be specified by the tmccn1 register. remark n = 0 to 5 table 9-2. tocn output control tocn output entocn alvcn external pulse output output level 0 0 disable high level 0 1 disable low level 1 0 enable when the cccn0 register is matched: low level when the cccn1 register is matched: high level 1 1 enable when the cccn0 register is matched: high level when the cccn1 register is matched: low level remark n = 0 to 5 figure 9-7. tmc1 compare operation example (set/reset output mode) tmc1 count value 0 count start cec1 1 clear & start clear & start ccc10 ccc10 ccc11 ccc11 ccc11 interrupt request (intccc10) interrupt request (intccc11) toc1 pin entoc1 1 alvc1 0
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 423 9.1.7 application examples (1) interval timer by setting the tmccn0 and tmccn1 registers as shown in figure 9-8, timer c operates as an interval timer that repeatedly generates interrupt requests with the value that was preset in the cccn0 register as the interval. when the counter value of the tmcn register matches the setting value of the cccn0 register, the tmcn register is cleared to 0000h and an interrupt request signal (intcccn0) is generated at the same time that the count operation resumes. remark n = 0 to 5 figure 9-8. contents of register settings when timer c is used as interval timer supply input clocks to internal units enable count operation 0 0/1 0/1 0/1 1 0/1 0/1 1 ostcn entocn alvcn eticn cclrcn cmscn1 cmscn0 0/1 0/1 0/1 0/1 0 0 1 1 ovfcn tmccn0 tmccn1 cscn2 cscn1 cscn0 cecn caecn use cccn0 register as compare register clear tmcn register due to match with cccn0 register continue counting after tmcn register overflows eclrcn remarks 1. 0/1: set to 0 or 1 as necessary 2. n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 424 figure 9-9. interval timer operation timing example 0000h 0001h p 0000h 0001h pp p p p p 0000h 0001h t count start interval time interval time interval time count clock tmcn register cccn0 register intcccn0 interrupt clear clear remarks 1. p: setting value of cccn0 register (0000h to ffffh) t: count clock cycle interval time = (p + 1) t 2. n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 425 (2) pwm output by setting the tmccn0 and tmccn1 registers as shown in figure 9-10, timer c can output a pwm signal, whose frequency is determined according to the setting of the cscn2 to cscn0 bits of the tmccn0 register, with the values that were preset in the cccn0 and cccn1 registers determining the intervals. when the counter value of the tmcn register matches the setting value of the cccn0 register, the tocn output becomes active. then, when the counter value of the tmcn register matches the setting value of the cccn1 register, the tocn output becomes inactive. the tmcn register continues counting. when it overflows, its count value is cleared to 0000h, and the register continues counting. in this way, a pwm signal whose frequency is determined according to the setting of the cscn2 to cscn0 bits of the tmccn0 register can be output. when the setting value of the cccn0 register and the setting value of the cccn1 register are the same, the tocn output remains inactive and does not change. the active level of the tocn output can be set by the alvcn bit of the tmccn1 register. remark n = 0 to 5 figure 9-10. contents of register settings when timer c is used for pwm output supply input clocks to internal units enable count operation 0 1 0/1 0/1 0 0/1 1 1 ostcn entocn alvcn eticn cclrcn cmscn1 cmscn0 0/1 0/1 0/1 0/1 0 0 1 1 ovfcn tmccn0 tmccn1 cscn2 cscn1 cscn0 cecn caecn use cccn0 register as compare register use cccn1 register as compare register disable clearing of tmcn register due to match with cccn0 register enable external pulse output (tocn) continue counting after tmcn register overflows eclrcn remarks 1. 0/1: set to 0 or 1 as necessary 2. n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 426 figure 9-11. pwm output operation timing example 0000h 0001h p ppp p p qqq q q qpq 0000h ffffh 0001h count clock tmcn register cccn0 register cccn1 register intcccn0 interrupt intcccn1 interrupt tocn (output) count start clear t remarks 1. p: setting value of cccn0 register (0000h to ffffh) q: setting value of cccn1 register (0000h to ffffh) p q t: count clock cycle pwm cycle = 65,536 t 65,536 p q duty ? = 2. in this example, the active level of the tocn output is set to the high level. 3. n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 427 (3) cycle measurement by setting the tmccn0 and tmccn1 registers as shown in figure 9-12, timer c can measure the cycle of signals input to the intpcm0 or intpcm1 pin. the valid edge of the intpcm0 pin is selected according to the iesc0m1 and iesc0m0 bits of the sescm register, and the valid edge of the intpcm1 pin is selected according to the iesc1m1 and iesc1m0 bits of the sescm register. either the rising edge, the falling edge, or both edges can be selected as the valid edges of both pins. if the cccm0 register is set as a capture register, the valid edge input of the intpcm0 pin is set as the trigger for capturing the tmcm register value in the cccm0 register. when this value is captured, an intcccm0 interrupt is generated. similarly, if the cccm1 register is set as a capture register, the valid edge input of the intpcm1 pin is set as the trigger for capturing the tmcm register value in the cccm1 register. when this value is captured, an intcccm1 interrupt is generated. the cycle of signals input to the intpcm0 pin is calculated by obtaining the difference between the tmcm register ? s count value (dx) that was captured in the cccm0 register according to the x-th valid edge input of the intpcm0 pin and the tmcm register ? s count value (d(x+1)) that was captured in the cccm0 register according to the (x+1)-th valid edge input of the intpcm0 pin and multiplying the value of this difference by the cycle of the clock control signal. the cycle of signals input to the intpcm1 pin is calculated by obtaining the difference between the tmcm register ? s count value (dx) that was captured in the cccm1 register according to the x-th valid edge input of the intpcm1 pin and the tmcm register ? s count value (d(x+1)) that was captured in the cccm1 register according to the (x+1)-th valid edge input of the intpcm1 pin and multiplying the value of this difference by the cycle of the clock control signal. remark m = 0 to 3 n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 428 figure 9-12. contents of register settings when timer c is used for cycle measurement supply input clocks to internal units enable count operation 0 0/1 0/1 0/1 0/1 0 0 0 ostcn entocn alvcn eticn cclrcn eclrcn cmscn1 cmscn0 0/1 0/1 0/1 0/1 0 0 1 1 ovfcn tmccn0 tmccn1 cscn2 cscn1 cscn0 cecn caecn use cccm0 register as capture register (when measuring the cycle of intpcm0 input) use cccm1 register as capture register (when measuring the cycle of intpcm1 input) continue counting after tmcm register overflows remarks 1. 0/1: set to 0 or 1 as necessary 2. m = 0 to 3 n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 429 figure 9-13. cycle measurement operation timing example 0001h 0000h 0001h 0000h ffffh d0 d1 d2 d3 d3 d2 d1 d0 (d1 ? d0) t (d3 ? d2) t {(10000h ? d1) + d2} t note t count clock tmcm register intpcm0 (input) cccm0 register intcccm0 interrupt intovcm interrupt no overflow overflow occurs no overflow clear count start note when an overflow is generated once. remarks 1. d0 to d3: tmcm register count values t: count clock cycle 2. in this example, the valid edge of the intpcm0 input has been set to both edges (rising and falling). 3. m = 0 to 3
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 430 9.1.8 cautions various cautions concerning timer c are shown below. (1) if a conflict occurs between the reading of the cccm0 register and a capture operation when the cccm0 register is used in capture mode, an external trigger (intpcm0) valid edge is detected and an external interrupt request (intcccm0) is generated, however, the timer value is not stored in the cccm0 register. (2) if a conflict occurs between the reading of the cccm1 register and a capture operation when the cccm1 register is used in capture mode, an external trigger (intpcm1) valid edge is detected and an external interrupt request (intcccm1) is generated, however, the timer value is not stored in the cccm1 register. (3) the following bits and registers must not be rewritten during operation (cecn = 1). ? cscn2 to cscn0 bits of tmccn0 register ? tmccn1 register ? sescm register (4) the caecn bit of the tmccn0 register is a tmcn reset signal. to use tmcn, first set the caecn bit to 1. (5) the digital noise elimination time (0 to 5) f x /4 are required to detect the valid edge of the external interrupt request signal (intpcm0 or intpcm1) or the external clock input (ticm). therefore, edge detection will not be performed normally for changes that are less than the digital noise elimination time. for details of digital noise elimination, see 14.6.3 timer c and timer enc1 input pins . (6) the operation of an external interrupt request signal (intcccn0 or intcccn1) is automatically determined according to the operating state of the capture/compare register. when the capture/compare register is used for a capture operation, the external interrupt request signal is used for valid edge detection. when the capture/compare register is used for a compare operation, the external interrupt request signal is used for an interrupt indicating a match with the tmcn register. (7) if the entocn and alvcn bits are changed at the same time, a glitch (spike shaped noise) may be generated in the tocn pin output. either create a circuit configuration that will not malfunction even if a glitch is generated or make sure that the entocn and alvcn bits are not changed at the same time. (8) even when using the intpc00/tic0, intpc10/tic1, intpc20/tic2, and intpc30/tic3 pins as intpc00, intpc10, intpc20, and intpc30, respectively, without using timer c, be sure to set the caecn and cecn bits of timer mode control registers c00 to c03 (tmcc00 to tmcc30) to 1. remark m = 0 to 3 n = 0 to 5
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 431 9.2 timer d 9.2.1 features timer d functions as a 16-bit interval timer. 9.2.2 function overview ? 16-bit interval timer: 4 channels ? compare registers: 4 ? interrupt request sources: 4 sources ? count clock selected from divisions of main clock 9.2.3 basic configuration table 9-3. timer d configuration timer count clock register read/write generated interrupt signal capture trigger timer output s/r other functions tmd0 read ???? cmd0 read/write intcmd0 ?? clear & start of timer c tmd1 read ???? cmd1 read/write intcmd1 ??? tmd2 read ???? cmd2 read/write intcmd2 ??? tmd3 read ???? timer d f x /8, f x /16, f x /32, f x /64, f x /128, f x /256, f x /512, f x /1,024 cmd3 read/write intcmd3 ??? remark f x : main clock s/r: set/reset (1) timer d (16-bit timer/counter) figure 9-14. timer d block diagram tmdn (16 bits) cmdn intcmdn 1/2 1/4 1/8 1/16 1/32 1/64 1/128 1/256 f x /4 clear & start remarks 1. n = 0 to 3 2. f x : main clock
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 432 9.2.4 timer d (1) timers d0 to d3 (tmd0 to tmd3) tmdn is a 16-bit timer. it is mainly used as an interval timer for software (n = 0 to 3). starting and stopping tmdn is controlled by the cedn bit of the timer mode control register dn (tmcdn) (n = 0 to 3). division by the prescaler can be selected for the count clock from among f x /8, f x /16, f x /32, f x /64, f x /128, f x /256, f x /512, and f x /1,024 by the csdn0 to csdn2 bits of the tmcdn register (f x : main clock). tmdn is read-only in 16-bit units. tmd1 fffff550h 0000h tmd2 fffff560h 0000h 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 tmd0 fffff540h 0000h address after reset 0 tmd3 fffff570h 0000h the conditions for which the tmdn register becomes 0000h are shown below (n = 0 to 3). ? reset input ? caedn bit = 0 ? cedn bit = 0 ? match of tmdn register and cmdn register ? overflow cautions 1. if the caedn bit of the tmcdn register is cleared to 0, a reset is performed asynchronously. 2. if the cedn bit of the tmcdn register is cleared to 0, a reset is performed, in synchronization with the internal clock. similarly, a synchronized reset is performed after a match with the cmdn register and after an overflow. 3. the count clock must not be changed during a timer operation. if it is to be overwritten, it should be overwritten after the cedn bit is cleared to 0. 4. up to 8 clocks (1 cycle = 1/f x (f x : main clock)) are required after a value is set in the cedn bit until the set value is transferred to internal units. when a count operation begins, the count cycle from 0000h to 0001h differs from subsequent cycles. 5. after a compare match is generated, the timer is cleared at the next count clock. therefore, if the division ratio is large, the timer value may not be zero even if the timer value is read immediately after a match interrupt is generated. 6. to initialize the tmdn register and start counting again, set the cedn bit of the tmcdn register to 1 after 8 clocks (1 cycle = 1/f x (f x : main clock)).
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 433 (2) compare registers d0 to d3 (cmd0 to cmd3) cmdn and the tmdn register count value are compared, and an interrupt request signal (intcmdn) is generated when a match occurs. tmdn is cleared, in synchronization with this match. if the caedn bit of the tmcdn register is cleared to 0, a reset is performed asynchronously, and the registers are initialized (n = 0 to 3). the cmdn registers are configured with a master/slave configuration. when a cmdn register is written, data is first written to the master register and then the master register data is transferred to the slave register. in a compare operation, the slave register value is compared with the count value of the tmdn register. when a cmdn register is read, data in the master side is read out. cmdn can be read or written in 16-bit units. cautions 1. a write operation to a cmdn register requires 8 clocks until the value that was set in the cmdn register is transferred to internal units. when writing continuously to the cmdn register, be sure to reserve a time interval of at least 8 clocks (1 cycle = 1/f x (f x : main clock)). 2. the cmdn register can be overwritten only once in a single tmdn register cycle (from 0000h until an intcmdn interrupt is generated due to a match of the tmdn register and cmdn register). if this cannot be secured by the application, make sure that the cmdn register is not overwritten during timer operation. 3. note that an intcmdn interrupt will be generated after an overflow if a value less than the counter value is written in the cmdn register during tmdn register operation (figure 9-15). cmd1 fffff552h 0000h cmd2 fffff562h 0000h 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 cmd0 fffff542h 0000h address after reset 0 cmd3 fffff572h 0000h
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 434 figure 9-15. example of timing during tmdn operation (a) when tmdn < < < < cmdn tmdn caedn cedn cmdn intcmdn mn n n remark m = tmdn value when overwritten n = cmdn value when overwritten m < n (b) when tmdn > > > > cmdn tmdn caedn cedn cmdn intcmdn m ffffh n n n remark m = tmdn value when overwritten n = cmdn value when overwritten m > n
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 435 9.2.5 control registers (1) timer mode control registers d0 to d3 (tmcd0 to tmcd3) the tmcdn registers control the operation of timer dn (n = 0 to 3). these registers can be read or written in 8-bit or 1-bit units. caution the caedn and other bits cannot be set at the same time. the other bits and the registers of the other tmdn units should always be set after the caedn bit has been set. (1/2) 7 0 0 0 0 tmcd0 tmcd1 tmcd2 tmcd3 6 csd02 csd12 csd22 csd32 5 csd01 csd11 csd21 csd31 4 csd00 csd10 csd20 csd30 3 0 0 0 0 2 0 0 0 0 ced0 ced1 ced2 ced3 caed0 caed1 caed2 caed3 address fffff544h fffff554h fffff564h fffff574h after reset 00h 00h 00h 00h <0> <1> bit position bit name function selects the tmdn internal count clock cycle. csdn2 csdn1 csdn0 count cycle 000f x /8 001f x /16 010f x /32 011f x /64 100f x /128 101f x /256 110f x /512 111f x /1,024 6 to 4 csdn2 to csdn0 caution the csdn2 to csdn0 bits must not be changed during timer operation. if they are to be changed, they must be changed after setting the cedn bit to 0. if these bits are overwritten during timer operation, operation cannot be guaranteed. remark f x : main clock 1cedn controls the operation of tmdn. 0: count disabled (stops at 0000h and does not operate) 1: counting operation is performed caution the cedn bit is not cleared even if a match is detected by the compare operation. to stop the count operation, clear the cedn bit. remark n = 0 to 3
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 436 (2/2) bit position bit name function 0 caedn controls the internal count clock. 0: the entire tmdn unit is reset asynchronously. the supply of input clocks to the tmdn unit stops. 1: input clocks are supplied to the tmdn unit. cautions 1. when the caedn bit is cleared to 0, the tmdn unit can be asynchronously reset. 2. when caedn = 0, the tmdn unit is in a reset state. therefore, to operate tmdn, the caedn bit must be set to 1. 3. if the caedn bit is cleared to 0, all the registers of the tmdn unit are initialized. if caedn is set to 1 again, be sure all the registers of the tmdn unit have been set again. remark n = 0 to 3
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 437 9.2.6 operation (1) compare operation tmdn can be used for a compare operation in which the value that was set in a compare register (cmdn) is compared with the tmdn count value (n = 0 to 3). if a match is detected by the compare operation, an interrupt (intcmdn) is generated. the generation of the interrupt causes tmdn to be cleared to 0 at the next count timing. this function enables timer d to be used as an interval timer. cmdn can also be cleared to 0. in this case, when an overflow occurs and tmdn becomes 0, a match is detected and intcmdn is generated. although the tmdn value is cleared to 0 at the next count timing, intcmdn is not generated by this match. figure 9-16. tmd0 compare operation example (1/2) (a) when cmd0 is set to n (non-zero) 1 0 n n tmd0 count clock cmd0 tmd0 clear match detected (intcmd0) count up clear remark interval time = (n + 1) (count clock cycle) n = 1 to 65,536 (ffffh)
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 438 figure 9-16. tmd0 compare operation example (2/2) (b) when cmd0 is cleared to 0 1 0 0 0 ffffh overflow tmd0 count clock cmd0 tmd0 clear match detected (intcmd0) count up clear remark interval time = (ffffh + 2) (count clock cycle)
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 439 9.2.7 application examples (1) interval timer this section explains an example in which timer d is used as an interval timer with 16-bit precision. interrupt requests (intcmdn) are output at equal intervals (see figure 9-16 tmd0 compare operation example ). the setup procedure is shown below (n = 0 to 3). <1> set the caedn bit to 1. <2> set each register. ? select the count clock using the csdn0 to csdn2 bits of the tmcdn register. ? set the compare value in the cmdn register. <3> start counting by setting the cedn bit to 1. <4> if the tmdn register and cmdn register values match, an intcmdn interrupt is generated. <5> intcmdn interrupts are generated thereafter at equal intervals. remark n = 0 to 3 9.2.8 cautions various cautions concerning timer d are shown below. (1) to operate tmdn, first set the caedn bit to 1. (2) up to 8 clocks are required after a value is set in the cedn bit until the set value is transferred to internal units. when a count operation begins, the count cycle from 0000h to 0001h differs from subsequent cycles (1 cycle = 1/f x (f x : main clock)). (3) to initialize the tmdn register status and start counting again, clear the cedn bit to 0 and then set the cedn bit to 1 after an interval of 8 clocks has elapsed. (4) up to 8 clocks are required until the value that was set in the cmdn register is transferred to internal units. when writing continuously to the cmdn register, be sure to secure a time interval of at least 8 clocks (1 cycle = 1/f x (f x : main clock)). (5) the cmdn register can be overwritten only once during a timer/counter operation (from 0000h until an intcmdn interrupt is generated due to a match of the tmdn register and cmdn register). if this cannot be secured, make sure that the cmdn register is not overwritten during a timer/counter operation. (6) the count clock must not be changed during a timer operation. if it is to be overwritten, it should be overwritten after the cedn bit is cleared to 0. if the count clock is overwritten during a timer operation, operation cannot be guaranteed. (7) a match signal will be generated after an overflow if a value less than the counter value is written in the cmdn register during tmdn register operation. remark n = 0 to 3
chapter 9 timer/counter function (real-time pulse unit) 440 preliminary user?s manual u16031ej2v1ud 9.3 timer enc1 9.3.1 features timers enc10 and enc11 (tmenc10, tmenc11) are 16-bit up/down counters that perform the following operations. ? general-purpose timer mode free-running timer pwm output ? up/down counter mode udc mode a udc mode b 9.3.2 function overview ? 16-bit 2-phase encoder input up/down counter & general-purpose timer (tmenc10, tmenc11): 2 channels ? compare registers: 4 ? capture/compare registers: 4 ? interrupt request sources ? capture/compare match interrupt: 4 sources ? compare match interrupt request: 4 sources ? capture request signal: 4 sources ? the tmenc1n value can be latched using the valid edge of the intp1n0 and intp1n1 pins corresponding to the capture/compare register as the capture trigger. ? count clock selectable through division by prescaler ? timer/counter count clock sources: 2 types (selection of external pulse input or main clock division) ? 2-phase encoder input the 2-phase external encoder signal is used as the count clock of the timer/counter via the external clock input pins (tiud1n, tcud1n). the counter mode can be selected from among the four following modes. ? mode 1: counts the input pulses of the count pulse input pin. up/down is specified by the level of the other input pin. ? mode 2: counts up/down using the respective input pulses of the up count pulse input pin and down count pulse input pin. ? mode 3: counts up/down using the phase relationship of the pulses input to the 2 pins. ? mode 4: counts up/down using the phase relationship of the pulses input to the 2 pins. counting is done using the respective rising edges and the falling edges of the pulses. ? pwm output function in the general-purpose timer mode, 16-bit resolution pwm can be output from the to1n pin.
chapter 9 timer/counter function (real-time pulse unit) preliminary user?s manual u16031ej2v1ud 441 ? timer clear the following timer clear operations are performed according to the mode that is used. (a) general-purpose timer mode: timer clear operation is possible upon occurrence of match with cm1n0 set value. (b) up/down counter mode: the timer clear operation can be selected from among the following four conditions. (i) timer clear performed upon occurrence of match with cm1n0 set value during tmenc1n up count operation, and timer clear performed upon occurrence of match with cm1n1 set value during tmenc1n down count operation. (ii) timer clear performed only by external input. (iii) timer clear performed upon occurrence of match between tmenc1n count value and cm1n0 set value. (iv) timer clear performed upon occurrence of external input and match between tmenc1n count value and cm1n0 set value. ? external pulse output (to1n): 2
chapter 9 timer/counter function (real-time pulse unit) 442 preliminary user?s manual u16031ej2v1ud 9.3.3 basic configuration table 9-4. timer enc1 configuration timer count clock register read/write generated interrupt signal capture trigger tmenc10 read/write ?? cm100 read/write intcm100 ? cm101 read/write intcm101 ? cc100 read/write intcc100 intp100 cc101 read/write intcc101 intp101 tmenc11 read/write ?? cm110 read/write intcm110 ? cm111 read/write intcm111 ? cc110 read/write intcc110 intp110 timer enc1 f x /8, f x /16, f x /32, f x /64, f x /128, f x /256, f x /512 cc111 read/write intcc111 intp111 remark f x : main clock
chapter 9 timer/counter function (real-time pulse unit) preliminary user?s manual u16031ej2v1ud 443 (1) timer enc1 (16-bit up/down counter) figure 9-17. timer enc1 block diagram r note q sq tmenc1n (16 bits) intp1n0/ intcc1n0 intp1n1/ intcc1n1 intov1n intud1n intcm1n0 intcm1n1 to1n clear tclr cm1n0 cm1n1 tiud1n intp1n0/ tcud1n intp1n1/ tclr1n cc1n0 cc1n1 selector selector selector selector selector selector clock division & selector tmenc1n clear controller ncc1n ncc0n internal bus internal bus f x /4 f x /32 f x /4 edge detector edge detector edge detector edge detector edge detector noise filter noise filter noise filter ce1n1 rlen1n enmd1n clr1n1 clr1n0 timer control register 1n (tmc1n) t1cmdn toe1n0 alvt1n0 mseln timer unit mode register 1n (tum1n) srtcn noise elimination width setting register 1n (ncw1n) srtin ncfn ncc1n ncc0n 1/2 1/4 1/8 1/16 1/32 1/64 1/128 external clock note reset priority remark f x : main clock
chapter 9 timer/counter function (real-time pulse unit) 444 preliminary user ? s manual u16031ej2v1ud 9.3.4 timer enc1 (1) timers enc10, enc11 (tmenc10, tmenc11) tmenc1n is a 2-phase encoder input up/down counter and general-purpose timer. it can be read or written in 16-bit units. cautions 1. writing to tmenc1n is enabled only when the ce1n1 bit of the tmc1n register is 0 (count operation disabled). 2. it is prohibited to set the t1cmdn bit (general-purpose timer mode) and the mseln bit (udc mode b) of the tum1n register to 0 and 1, respectively. 3. continuous reading of tmenc1n is prohibited. if tmenc1n is continuously read, the second read value may differ from the actual value. if tmenc1n must be read twice, be sure to read another register between the first and the second read operation. 4. writing the same value to the tmenc1n, cc1n0, and cc1n1 registers, and the status1n register is prohibited. writing the same value to the ccr1n, tum1n, tmc1n, sesa1n, and prm1n registers, and cm1n0 and cm1n1 registers is permitted (writing the same value is guaranteed even during a count operation). 14 13 12 2 3 4 5 6 7 8 9 10 11 15 10 tmenc10 address fffff5a0h after reset 0000h tmenc11 fffff5d0h 0000h tmenc1n start and stop is controlled by the ce1n1 bit of timer control register 1n (tmc1n). the tmenc1n operation consists of the following two modes. (a) general-purpose timer mode in the general-purpose timer mode, tmenc1n operates as a 16-bit interval timer, free-running timer, or pwm output. counting is performed based on the clock selected by software. division by the prescaler can be selected for the count clock from among f x /8, f x /16, f x /32, f x /64, f x /128, f x /256, or f x /512 using the prm1n2 to prm1n0 bits of prescaler mode register 1n (prm1n) (f x : main clock).
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 445 (b) up/down counter mode (udc mode) in the udc mode, tmenc1n functions as a 16-bit up/down counter that performs counting based on the tcud1n and tiud1n input signals. two operation modes can be set by the mseln bit of the tum1n register for this mode. (i) udc mode a (when t1cmdn bit = 1, mseln bit = 0) tmenc1n can be cleared by setting the clr1n1 and clr1n0 bits of the tmc1n register. (ii) udc mode b (when t1cmdn bit = 1, mseln bit = 1) tmenc1n is cleared upon a match with cm1n0 during a tmenc1n up count operation. tmenc1n is cleared upon a match with cm1n1 during a tmenc1n down count operation. when the ce1n1 bit of the tmc1n register is 1, tmenc1n counts up when the operation mode is the general-purpose mode, and counts up/down when the operation mode is the udc mode. cautions 1. the tcud1n and intp1n0 pins function alternately. therefore, because the tcud1n pin is used in the udc mode, the external capture function of the intp1n0 pin cannot be used. 2. the tclr1n and intp1n1 pins function alternately. therefore, when the tclr1n input is used in udc mode a, the external capture function of the intp1n1 pin cannot be used. the conditions for clearing tmenc1n are as follows, depending on the operation mode. table 9-5. timer enc1 (tmenc1n) clear conditions tum1n register tmc1n register operation mode t1cmdn bit mseln bit enmd1n bit clr1n1 bit clr1n0 bit tmenc1n clear 0 clearing not performed general-purpose timer mode 00 1 cleared upon match with cm1n0 set value 0 0 cleared only by tclr1n input 0 1 cleared upon match with cm1n0 set value during up count operation 1 0 cleared by tclr1n input or upon match with cm1n0 set value during up count operation udc mode a 1 0 1 1 clearing not performed udc mode b 1 1 cleared upon match with cm1n0 set value during up count operation or upon match with cm1n1 set value during down count operation other than the above setting prohibited remark : indicates that the set value of that bit is ignored.
chapter 9 timer/counter function (real-time pulse unit) 446 preliminary user ? s manual u16031ej2v1ud (2) compare registers 100, 110 (cm100, cm110) cm1n0 is a 16-bit register that always compares its value with the value of tmenc1n. when the value of a compare register matches the value of tmenc1n, an interrupt signal is generated. the interrupt generation timing in the various modes is described below. ? in the general-purpose timer mode (t1cmdn bit of tum1n register = 0) and udc mode a (mseln bit of tum1n register = 0), an interrupt signal (intcm1n0) is always generated upon occurrence of a match. ? in udc mode b (mseln bit of tum1n register = 1), an interrupt signal (intcm1n0) is generated only upon occurrence of a match during an up count operation. cm1n0 can be read or written in 16-bit units. caution when the ce1n1 bit of the tmc1n register is 1, it is prohibited to overwrite the value of the cm1n0 register. cm110 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 cm100 fffff5a2h fffff5d2h 0000h 0000h address after reset 0 (3) compare registers 101, 111 (cm101, cm111) cm1n1 is a 16-bit register that always compares its value with the value of tmenc1n. when the value of the compare register matches the value of tmenc1n, an interrupt signal is generated. the interrupt generation timing in the various modes is described below. ? in the general-purpose timer mode (t1cmdn bit of tum1n register = 0) and udc mode a (mseln bit of tum1n register = 0), an interrupt signal (intcm1n1) is always generated upon occurrence of a match. ? in udc mode b (mseln bit of tum1n register = 1), an interrupt signal (intcm1n1) is generated only upon occurrence of a match during a down count operation. cm1n1 can be read or written in 16-bit units. caution when the ce1n1 bit of the tmc1n register is 1, it is prohibited to overwrite the value of the cm1n1 register. cm111 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 cm101 fffff5a4h fffff5d4h 0000h 0000h address after reset 0
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 447 (4) capture/compare registers 100, 110 (cc100, cc110) cc1n0 is a 16-bit register. it can be specified as a capture register or as a compare register using capture/compare control register 1n (ccr1n). cc1n0 can be read or written in 16-bit units. cautions 1. when used as a capture register (cmsn0 bit of ccr1n register = 0), write access from the cpu is prohibited. 2. when used as a compare register (cmsn0 bit of ccr1n register = 1) and the ce1n1 bit of the tmc1n register is 1, overwriting the cc1n0 register values is prohibited. 3. when the ce1n1 bit of the tmc1n register is 0, the capture trigger is disabled. 4. when the operation mode is changed from capture register to compare register, set a new compare value. 5. continuous reading of cc1n0 is prohibited. if cc1n0 is continuously read, the second read value may differ from the actual value. if cc1n0 must be read twice, be sure to read another register between the first and the second read operation. cc110 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 cc100 fffff5a6h fffff5d6h 0000h 0000h address after reset 0 (a) when set as a capture register when cc1n0 is set as a capture register, the valid edge of the corresponding external interrupt intp1n0 signal is detected as the capture trigger. tmenc1n latches the count value in synchronization with the capture trigger (capture operation). the latched value is held in the capture register until the next capture operation. the valid edge of external interrupts (rising edge, falling edge, both edges) is selected by valid edge select register 1n (sesa1n). when the cc1n0 register is specified as a capture register, interrupts are generated upon detection of the valid edge of the intp1n0 signal. caution the tcud1n and intp1n0 pins function alternately. therefore, because the tcud1n pin is used in the udc mode, the external capture function of the intp1n0 pin cannot be used. (b) when set as a compare register when cc1n0 is set as a compare register, it always compares its own value with the value of tmenc1n. if the value of cc1n0 matches the value of the tmenc1n, cc1n0 generates an interrupt signal (intcc1n0).
chapter 9 timer/counter function (real-time pulse unit) 448 preliminary user ? s manual u16031ej2v1ud (5) capture/compare registers 101, 111 (cc101, cc111) cc1n1 is a 16-bit register. it can be specified as a capture register or as a compare register using capture/compare control register 1n (ccr1n). cc1n1 can be read or written in 16-bit units. cautions 1. when used as a capture register (cmsn1 bit of ccr1n register = 0), write access from the cpu is prohibited. 2. when used as a compare register (cmsn1 bit of ccr1n register = 1) and the ce1n1 bit of the tmc1n register is 1, overwriting the cc1n1 register values is prohibited. 3. when the ce1n1 bit of the tmc1n register is 0, the capture trigger is disabled. 4. when the operation mode is changed from capture register to compare register, newly set a compare value. 5. continuous reading of cc1n1 is prohibited. if cc1n1 is continuously read, the second read value may differ from the actual value. if cc1n1 must be read twice, be sure to read another register between the first and the second read operation. cc111 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 cc101 fffff5a8h fffff5d8h 0000h 0000h address after reset 0 (a) when set as a capture register when cc1n1 is set as a capture register, the valid edge of the corresponding external interrupt intp1n1 signal is detected as the capture trigger. tmenc1n latches the count value in synchronization with the capture trigger (capture operation). the latched value is held in the capture register until the next capture operation. the valid edge of external interrupts (rising edge, falling edge, both edges) is selected by valid edge select register 1n (sesa1n). when the cc1n1 register is specified as a capture register, interrupts are generated upon detection of the valid edge of the intp1n1 signal. caution the tclr1n and intp1n1 pins function alternately. therefore, when the tclr1n input is used in udc mode a, the external capture function of the intp1n1 pin cannot be used. (b) when set as a compare register when cc1n1 is set as a compare register, it always compares its own value with the value of tmenc1n. if the value of cc1n1 matches the value of the tmenc1n, cc1n1 generates an interrupt signal (intcc1n1).
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 449 9.3.5 control registers (1) timer unit mode registers 10, 11 (tum10, tum11) the tum1n register is an 8-bit register used to specify the tmenc1n operation mode or to control the operation of the pwm output pin. tum1n can be read or written in 8-bit or 1-bit units. cautions 1. changing the value of the tum1n register during tmenc1n operation (ce1n1 bit of tmc1n register = 1) is prohibited. 2. when the t1cmdn bit = 0 (general-purpose timer mode), setting mseln bit = 1 (udc mode b) is prohibited. 7 t1cmd0 tum10 6 0 5 0 4 0 3 toe100 2 alvt100 1 0 0 msel0 address fffff5abh after reset 00h t1cmd1 tum11 0 0 0 toe110 alvt110 0 msel1 fffff5dbh 00h bit position bit name function 7 t1cmdn specifies tmenc1n operation mode. 0: general-purpose timer mode (up count) 1: udc mode (up/down count) 3 toe1n0 specifies timer output (to1n) enable. 0: timer output disabled 1: timer output enabled caution when t1cmdn bit = 1 (udc mode), timer output is not performed regardless of the setting of the toe1n0 bit. at this time, timer output consists of the negative phase level of the level set by the alvt1n0 bit. 2 alvt1n0 specifies active level of timer output (to1n). 0: active level is high level 1: active level is low level caution when t1cmdn bit = 1 (udc mode), timer output is not performed regardless of the setting of the toe1n0 bit. at this time, timer output consists of the negative phase level of the level set by the alvt1n0 bit. 0 mseln specifies operation in udc mode (up/down count) 0: udc mode a tmenc1n can be cleared by setting the clr1n1 and clr1n0 bits of the tmc1n register. 1: udc mode b tmenc1n is cleared in the following cases. ? upon match with cm1n0 during tmenc1n up count operation ? upon match with cm1n1 during tmenc1n down count operation when udc mode b is set, the enmd1n, clr1n1, and clr1n0 bits of the tmc1n register become invalid. remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 450 preliminary user ? s manual u16031ej2v1ud (2) timer control registers 10, 11 (tmc10, tmc11) the tmc1n register is used to enable/disable tmenc1n operation and to set transfer and timer clear operations. tmc1n can be read or written in 8-bit or 1-bit units. caution changing the values of the tmc1n register bits other than the ce1n1 bit during tmenc1n operation (ce1n1 bit = 1) is prohibited. (1/2) 7 0 tmc10 <6> ce101 5 0 4 0 3 rlen10 2 enmd10 1 clr101 0 clr100 address fffff5ach after reset 00h 0 tmc11 ce111 0 0 rlen11 enmd11 clr111 clr110 fffff5dch 00h bit position bit name function 6 ce1n1 enables/disables tmenc1n operation. 0: tmenc1n count operation disabled 1: tmenc1n count operation enabled 3 rlen1n enables/disables transfer from cm1n0 to tmenc1n. 0: transfer disabled 1: transfer enabled cautions 1. when rlen1n = 1, the value set to cm1n0 is transferred to tmenc1n upon occurrence of a tmenc1n underflow. 2. when the t1cmdn bit of the tum1n register = 0 (general-purpose timer mode), the rlen1n bit setting becomes invalid. 3. the rlen1n bit is valid only in udc mode a (tum1n register?s t1cmdn bit = 1, mseln bit = 0). in the general-purpose timer mode (t1cmdn bit = 0) and in udc mode b (t1cmdn bit = 1, mseln bit = 1), a transfer operation is not performed even the rlen1n bit is set to 1. 2 enmd1n enables/disables clearing of tmenc1n in general-purpose timer mode (t1cmdn bit of tum1n register = 0). 0: clear disabled (free-running mode) clearing is not performed even when tmenc1n and cm1n0 values match. 1: clear enabled clearing is performed when tmenc1n and cm1n0 values match. caution when the t1cmdn bit of the tum1n register = 1 (udc mode), the enmd1n bit setting becomes invalid. remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 451 (2/2) bit position bit name function controls tmenc1n clear operation in udc mode a. clr1n1 clr1n0 specifies tmenc1n clear source 0 0 cleared only by external input (tclr1n) 0 1 cleared upon match of tmenc1n count value and cm1n0 set value 1 0 cleared by tclr1n input or upon match of tmenc1n count value and cm1n0 set value 1 1 not cleared 1, 0 clr1n1, clr1n0 cautions 1. clearing by match of the tmenc1n count value and cm1n0 set value is valid only during a tmenc1n up count operation (tmenc1n is not cleared during a tmenc1n down count operation). 2. when the t1cmdn bit of the tum1n register = 0 (general-purpose timer mode), the clr1n1 and clr1n0 bit settings are invalid. 3. when the mseln bit of the tum1n register = 1 (udc mode b), the clr1n1 and clr1n0 bit settings are invalid. 4. when clearing by tclr1n has been enabled by bits clr1n1 and clr1n0, clearing is performed whether the value of the ce1n1 bit is 1 or 0. remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 452 preliminary user ? s manual u16031ej2v1ud (3) capture/compare control registers 10, 11 (ccr10, ccr11) the ccr1n register specifies the operation mode of the capture/compare registers (cc1n0, cc1n1). ccr1n can be read or written in 8-bit or 1-bit units. cautions 1. overwriting the ccr1n register during tmenc1n operation (ce1n1 bit = 1) is prohibited. 2. the tcud1n and intp1n0 pins function alternately. therefore, because the tcud1n pin is used in the udc mode, the external capture function of the intp1n0 pin cannot be used. 3. the tclr1n and intp1n1 pins function alternately. therefore, when the tclr1n input is used in udc mode a, the external capture function of the intp1n1 pin cannot be used. 7 0 ccr10 6 0 5 0 4 0 3 0 2 0 1 cms01 0 cms00 address fffff5aah after reset 00h 0 ccr11 00000 cms11 cms10 fffff5dah 00h bit position bit name function 1 cmsn1 specifies operation mode of cc1n1. 0: capture register 1: compare register 0 cmsn0 specifies operation mode of cc1n0. 0: capture register 1: compare register remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 453 (4) valid edge select registers 10, 11 (sesa10, sesa11) the sesa1n register is used to specify the valid edge of external interrupt requests from external pins (intp100, intp101, intp110, intp111, tiud10, tiud11, tcud10, tcud11, tclr10, tclr11). the valid edge (rising edge, falling edge, or both rising and falling edges) can be specified independently for each pin. sesa1n can be read or written in 8-bit or 1-bit units. cautions 1. changing the values of the sesa1n register bits during tmenc1n operation (ce1n1 bit = 1) is prohibited. 2. before setting the trigger mode of the intp100, intp101, intp110, intp111, tiud10, tiud11, tcud10, tcud11, tclr10, and tclr11 pins, set the pmcdh register. if the pmcdh register is set after the sesa1n register has been set, an illegal interrupt, incorrect counting, and incorrect clearing may occur depending on the timing of setting the pmcdh register. (1/2) 7 tesud01 sesa10 6 tesud00 5 cesud01 4 cesud00 3 ies101 2 ies100 1 ies001 0 ies000 address fffff5adh after reset 00h tiud10, tcud10 tclr10 intp101 intp100 7 tesud11 sesa11 6 tesud10 5 cesud11 4 cesud10 3 ies111 2 ies110 1 ies011 0 ies010 address fffff5ddh after reset 00h tclr11 tiud11, tcud11 intp111 intp110 bit position bit name function specifies valid edge of pins tiud1n, tcud1n. tesudn1 tesudn0 valid edge 0 0 falling edge 0 1 rising edge 1 0 setting prohibited 1 1 both rising and falling edges 7, 6 tesudn1, tesudn0 cautions 1. the set values of the tesudn1 and tesudn0 bits are only valid in udc mode a and udc mode b. 2. if mode 4 is specified as the operation mode of tmenc1n (specified by the prm1n2 to prm1n0 bits of the prm1n register), the valid edge specifications for the tiud1n and tcud1n pins (bits tesudn1 and tesudn0) are not valid. remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 454 preliminary user ? s manual u16031ej2v1ud (2/2) bit position bit name function specifies valid edge of tclr1n pin. cesudn1 cesudn0 valid edge 0 0 falling edge 0 1 rising edge 10low level 1 1 high level 5, 4 cesudn1, cesudn0 the set values of bits cesudn1 and cesudn0 and the tmenc1n operation are related as follows. 00: tmenc1n cleared after detection of rising edge of tclr1n 01: tmenc1n cleared after detection of falling edge of tclr1n 10: tmenc1n cleared status held while tclr1n input is low level 11: tmenc1n cleared status held while tclr1n input is high level caution the set values of the cesudn1 and cesudn0 bits are valid only in udc mode a. specifies valid edge of intp1n1 pin. ies1n1 ies1n0 valid edge 0 0 falling edge 0 1 rising edge 1 0 setting prohibited 1 1 both rising and falling edges 3, 2 ies1n1, ies1n0 specifies valid edge of intp1n0 pin. ies0n1 ies0n0 valid edge 0 0 falling edge 0 1 rising edge 1 0 setting prohibited 1 1 both rising and falling edges 1, 0 ies0n1, ies0n0 remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 455 (5) prescaler mode registers 10, 11 (prm10, prm11) the prm1n register is used to perform the following selections. ? selection of count clock in general-purpose timer mode (t1cmdn bit of tum1n register = 0) ? selection of count operation mode in udc mode (t1cmdn bit = 1) prm1n can be read or written in 8-bit or 1-bit units. cautions 1. overwriting the prm1n register during tmenc1n operation (ce1n1 bit = 1) is prohibited. 2. when the t1cmdn bit of the tum1n register = 1 (udc mode), setting the values of the prm1n2 to prm1n0 to 000, 001, 010, and 011 bits is prohibited. 3. when tmenc1n is in mode 4, specification of the valid edge for the tiud1n and tcud1n pins is invalid. 7 0 prm10 6 0 5 0 4 0 3 0 2 prm102 1 prm101 0 prm100 address fffff5aeh after reset 07h 0 prm11 0000 prm112 prm111 prm110 fffff5deh 07h bit position bit name function specifies the up/down count operation mode during input of the clock rate when the internal clock of the tmenc1n is used, or during external clock (tiud1n) input. t1cmdn = 0 t1cmdn = 1 prm1n2 prm1n1 prm1n0 count clock count clock up/down count 0 0 0 setting prohibited 001f x /8 010f x /16 011f x /32 setting prohibited (mode 4) (at this time, sesa1n register is enabled.) 100f x /64 mode 1 101f x /128 mode 2 110f x /256 mode 3 111f x /512 tiud1n mode 4 2 to 0 prm1n2 to prm1n0 remark f x : main clock remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 456 preliminary user ? s manual u16031ej2v1ud (a) in general-purpose timer mode (t1cmdn bit of tum1n register = 0) the count clock is fixed to the internal clock. the clock rate of tmenc1n is specified by bits prm1n2 to prm1n0. (b) udc mode (t1cmdn bit of tum1n register = 1) the tmenc1n count triggers in the udc mode are as follows. operation mode tmenc1n operation mode 1 down count when tcud1n = high level up count when tcud1n = low level mode 2 up count upon detection of valid edge of tiud1n input down count upon detection of valid edge of tcud1n input mode 3 automatic judgment with tcud1n input level upon detection of valid edge of tiud1n input mode 4 automatic judgment upon detection of both edges of tiud1n input and both edges of tcud1n input
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 457 (6) status registers 10, 11 (status10, status11) the status1n register indicates the operating status of tmenc1n. status1n is read-only in 8-bit or 1-bit units. caution overwriting the status1n register during tmenc1n operation (ce1n1 bit = 1) is prohibited. 7 0 status10 6 0 5 0 4 0 3 0 <2> udf10 <1> ovf10 <0> ubd10 address fffff5afh after reset 00h 0 status11 0000udf11ovf11ubd11 fffff5dfh 00h bit position bit name function 2 udf1n tmenc1n underflow flag 0: no tmenc1n count underflow 1: tmenc1n count underflow caution the udf1n bit is cleared to 0 upon completion of a read access to the status1n register from the cpu. 1 ovf1n tmenc1n overflow flag 0: no tmenc1n count overflow 1: tmenc1n count overflow caution the ovf1n bit is cleared to 0 upon completion of a read access to the status1n register from the cpu. 0ubd1n indicates the operating status of tmenc1n up/down count. 0: tmenc1n up count in progress 1: tmenc1n down count in progress caution the state of the ubd1n bit differs according to the mode as follows. ? ? ? ? the ubd1n bit is fixed to 0 by hardware when the t1cmdn bit of the tum1n register = 0 (general-purpose timer mode). ? ? ? ? the ubd1n bit indicates the tmenc1n up/down count status when the t1cmdn bit of the tum1n register = 1 (udc mode). remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 458 preliminary user ? s manual u16031ej2v1ud (7) noise elimination width setting registers 10, 11 (ncw10, ncw11) the ncw1n register is used to set the noise elimination width of the digital noise filter of the timer enc1 input pin. ncw1n can be read or written in 8-bit units. cautions 1. whether the signal is input through or inverted can be specified for each of the intp1n0/tcud1n and tiud1n pins. the setting of the noise elimination width by the ncfn, ncc1n, and ncc0n bits is for each timer and cannot be changed for each pin. 2. the setting of the srtcn bit is valid even when the intp1n0/tcud1n pin is used as a capture trigger (intp1n0). 7 0 ncw10 6 0 5 srtc0 4 srti0 3 0 2 ncf0 1 ncc10 0 ncc00 address fffff5c0h after reset 02h 0 ncw11 0 srtc1 srti1 0 ncf1 ncc11 ncc01 fffff5f0h 02h bit position bit name function 5 srtcn sets the input mode of the intp1n0/tcud1n pin. 0: through input 1: inverted this bit specifies whether the signal input from the intp1n0/tcud1n pin is input through to tmenc1n or inverted. 4 srtin sets the input mode of the tiud1n pin. 0: through input 1: inverted this bit specifies whether the signal input from the tiud1n pin is input through to tmenc1n or inverted. 2 ncfn specifies the clock frequency for noise elimination. 0: f x /4 1: f x /32 this bit selects the clock source of the noise filter. specify the number of clocks by which noise is to be eliminated. ncc1n ncc0n number of clocks by which noise is to be eliminated 0 0 0 (through input) note 012 103 115 1, 0 ncc1n, ncc0n note clear the ncfn bit to 0 for through input. these bits select the number of clocks by which noise is to be eliminated. remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user?s manual u16031ej2v1ud 459 (a) relationship between ncw1n register set value and noise elimination width table 9-6. relationship between ncw1n register set value and noise elimination width ncw1n register noise elimination width (ns) ncfn bit ncc1n bit ncc0n bit f x = 150 mhz f x = 133 mhz f x = 100 mhz remark 000000thr ough 0 0 1 53.3 to 80.0 60.2 to 90.2 80 to 120 (1/(f x /4)) 2 0 1 0 80.0 to 106.7 90.2 to 120.3 120 to 160 (1/(f x /4)) 3 0 1 1 133.3 to 160.0 150.4 to 180.5 200 to 240 (1/(f x /4)) 5 100000thr ough 1 0 1 426.7 to 640.0 481.2 to 721.8 640 to 960 (1/(f x /32)) 2 1 1 0 640.0 to 853.3 721.8 to 962.9 960 to 1,280 (1/(f x /32)) 3 1 1 1 1,066.7 to 1,280.0 1,203.0 to 1,443.6 1,600 to 1,920 (1/(f x /32)) 5 remarks 1. n = 0, 1 2. f x : main clock
chapter 9 timer/counter function (real-time pulse unit) 460 preliminary user ? s manual u16031ej2v1ud 9.3.6 operation (1) basic operation the following two operation modes can be selected for tmenc1n. (a) general-purpose timer mode (t1cmdn bit of tum1n register = 0) in the general-purpose timer mode, tmenc1n operates either as a 16-bit interval timer or as a pwm output timer (count operation is up count only). the count clock to tmenc1n is selected by prescaler mode register 1n (prm1n) (n = 0, 1). (b) up/down counter mode (udc mode) (t1cmdn bit of tum1n register = 1) in the udc mode, tmenc1n operates as a 16-bit up/down counter. the external clock input (tiud1n, tcud1n pins) by prm1n register setting is used as the tmenc1n count clock. the udc mode is further divided into two modes according to the tmenc1n clear conditions. ? ? ? ? udc mode a (tum1n register?s t1cmdn bit = 1, mseln bit = 0) the tmenc1n clear source can be selected as only external clear input (tclr1n), a match signal between the tmenc1n count value and the cm1n0 set value during up count operation, or the logical sum (or) of the two signals, using bits clr1n1 and clr1n0 of the tmc1n register. tmenc1n can transfer the value of cm1n0 upon occurrence of a tmenc1n underflow. ? ? ? ? udc mode b (tum1n register?s t1cmdn bit = 1, mseln bit = 1) the status of tmenc1n after a match of the tmenc1n count value and cm1n0 set value is as follows. <1> in the case of an up count operation, tmenc1n is cleared to 0000h, and the intcm1n0 interrupt is generated. <2> in the case of a down count operation, the tmenc1n count value is decremented ( ? 1). the status of tmenc1n after a match of the tmenc1n count value and cm1n1 set value is as follows. <1> in the case of an up count operation, the tmenc1n count value is incremented (+1). <2> in the case of a down count operation, tmenc1n is cleared to 0000h, and the intcm1n1 interrupt is generated.
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 461 (2) operation in general-purpose timer mode tmenc1n can perform the following operations in the general-purpose timer mode. (a) interval operation tmenc1n and cm1n0 always compare their values and the intcm1n0 interrupt is generated upon occurrence of a match. tmenc1n is cleared to 0000h at the count clock following the match. furthermore, when one more count clock is input, tmenc1n counts up to 0001h. the interval time can be calculated with the following formula. interval time = (cm1n0 value + 1) tmenc1n count clock rate caution interval operation can be achieved by setting the enmd1n bit of the tmc1n register to 1. (b) free-running operation tmenc1n performs a full count operation from 0000h to ffffh, and after the ovf1n bit of the status1n register is set to 1, tmenc1n is cleared and resumes counting. the free-running cycle can be calculated by the following formula. free-running cycle = 65,536 tmenc1n count clock rate caution the free-running operation can be achieved by setting the enmd1n bit of the tmc1n register to 0. (c) compare function tmenc1n connects two compare register (cm1n0, cm1n1) channels and two capture/compare register (cc1n0, cc1n1) channels. when the tmenc1n count value and the set value of one of the compare registers match, a match interrupt (intcm1n0, intcm1n1, intcc1n0 note , intcc1n1 note ) is output. particularly in the case of interval operation, tmenc1n is cleared upon generation of the intcm1n0 interrupt. note this match interrupt is generated when cc1n0 and cc1n1 are set to the compare register mode.
chapter 9 timer/counter function (real-time pulse unit) 462 preliminary user ? s manual u16031ej2v1ud (d) capture function tmenc1n connects two capture/compare register (cc1n0, cc1n1) channels. when cc1n0 and cc1n1 are set to the capture register mode, the value of tmenc1n is captured in synchronization with the corresponding capture trigger signal. furthermore, an interrupt request (intcc1n0, intcc1n1) is generated by the intp1n0, intp1n1 input signals. table 9-7. capture trigger signal (tmenc1n) to 16-bit capture register capture register capture trigger signal cc1n0 intp1n0 cc1n1 intp1n1 remark cc1n0 and cc1n1 are capture/compare registers. which of these registers is used is specified by capture/compare control register 1n (ccr1n). the valid edge of the capture trigger is specified by valid edge select register 1n (sesa1n). if both the rising edge and the falling edge are selected as the capture triggers, it is possible to measure the input pulse width externally. if a single edge is selected as the capture trigger, the input pulse cycle can be measured. (e) pwm output operation pwm output operation is performed from the to1n pin by setting tmenc1n to the general-purpose timer mode (t1cmdn bit = 0) using timer unit mode register 1n (tum1n). the resolution is 16 bits, and the count clock can be selected from among seven internal clocks (f x /8, f x /16, f x /32, f x /64, f x /128, f x /256, f x /512). figure 9-18. tmenc1n block diagram (during pwm output operation) tmenc1n (16 bits) compare register (cm1n0) compare register (cm1n1) s intcm1n0 intcm1n1 alvt1n0 tum1n register clear 16 16 to1n q r f x /8 f x /16 f x /32 f x /64 f x /128 f x /256 f x /512 remarks 1. f x : main clock 2. n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 463 (i) description of operation the cm1n0 register is a compare register used to set the pwm output cycle. when the value of this register matches the value of tmenc1n, the intcm1n0 interrupt is generated. the compare match is saved by hardware, and tmenc1n is cleared at the next count clock after the match. the cm1n1 register is a compare register used to set the pwm output duty. set the duty required for the pwm cycle. figure 9-19. pwm signal output example (when alvt1n0 bit = 0 is set) cm1n0 set value cm1n1 set value tmenc1n to1n intcm1n0 intcm1n1 cautions 1. changing the values of the cm1n0 and cm1n1 registers is prohibited during tmenc1n operation (ce1n1 bit of tmc1n register = 1). 2. changing the value of the alvt1n0 bit of the tum1n register is prohibited during tmenc1n operation. 3. pwm signal output is performed from the second pwm cycle after the ce1n1 bit is set to 1. remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 464 preliminary user ? s manual u16031ej2v1ud (3) operation in udc mode (a) overview of operation in udc mode the count clock input to tmenc1n in the udc mode (t1cmdn bit of tum1n register = 1) can only be externally input from the tiud1n and tcud1n pins. up/down count judgment in the udc mode is determined based on the phase difference of the tiud1n and tcud1n pin inputs according to the prm1n register setting (there is a total of four choices). table 9-8. list of count operations in udc mode prm1n register prm1n2 prm1n1 prm1n0 operation mode tmenc1n operation 1 0 0 mode 1 down count when tcud1n = high level up count when tcud1n = low level 1 0 1 mode 2 up count upon detection of valid edge of tiud1n input down count upon detection of valid edge of tcud1n input 1 1 0 mode 3 automatic judgment in tcud1n input level upon detection of valid edge of tiud1n input 1 1 1 mode 4 automatic judgment upon detection of both edges of tiud1n input and both edges of tcud1n input remark n = 0, 1 the udc mode is further divided into two modes according to the tmenc1n clear conditions (a count operation is performed only with tiud1n and tcud1n input in both modes). ? ? ? ? udc mode a (tum1n register?s t1cmdn bit = 1, mseln bit = 0) the tmenc1n clear source can be selected as only external clear input (tclr1n), a match signal between the tmenc1n count value and the cm1n0 set value during up count operation, or the logical sum (or) of the two signals, using bits clr1n1 and clr1n0 of the tmc1n register. tmenc1n can transfer the value of cm1n0 upon occurrence of a tmenc1n underflow. ? ? ? ? udc mode b (tum1n register?s t1cmdn bit = 1, mseln bit = 1) the status of tmenc1n after a match of the tmenc1n count value and cm1n0 set value is as follows. <1> in the case of an up count operation, tmenc1n is cleared to 0000h, and the intcm1n0 interrupt is generated. <2> in the case of a down count operation, the tmenc1n count value is decremented ( ? 1). the status of tmenc1n after a match of the tmenc1n count value and cm1n1 set value is as follows. <1> in the case of an up count operation, the tmenc1n count value is incremented (+1). <2> in the case of a down count operation, tmenc1n is cleared to 0000h, and the intcm1n1 interrupt is generated.
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 465 (b) up/down count operation in udc mode tmenc1n up/down count judgment in the udc mode is determined based on the phase difference of the tiud1n and tcud1n pin inputs according to the prm1n register setting. (i) mode 1 (prm1n2 bit = 1, prm1n1 bit = 0, prm1n0 bit = 0) in mode 1, the following count operations are performed based on the level of the tcud1n pin upon detection of the valid edge of the tiud1n pin. ? tmenc1n down count operation when tcud1n pin = high level ? tmenc1n up count operation when tcud1n pin = low level figure 9-20. mode 1 (when rising edge is specified as valid edge of tiud1n pin) tiud1n tcud1n tmenc1n 0006h 0007h down count up count 0005h 0004h 0005h 0006h 0007h remark n = 0, 1 figure 9-21. mode 1 (when rising edge is specified as valid edge of tiud1n pin): in case of simultaneous tiud1n, tcud1n pin edge timing 0007h tiud1n tcud1n tmenc1n 0006h down count up count 0005h 0004h 0005h 0006h 0007h remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 466 preliminary user ? s manual u16031ej2v1ud (ii) mode 2 (prm1n2 bit = 1, prm1n1 bit = 0, prm1n0 bit = 1) the count conditions in mode 2 are as follows. ? tmenc1n up count upon detection of valid edge of tiud1n pin ? tmenc1n down count upon detection of valid edge of tcud1n pin caution if the count clock is simultaneously input to the tiud1n pin and the tcud1n pin, count operation is not performed and the immediately preceding value is held. figure 9-22. mode 2 (when rising edge is specified as valid edge of tiud1n, tcud1n pins) 0006h tiud1n tcud1n tmenc1n 0007h 0008h up count hold value down count 0007h 0006h 0005h remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 467 (iii) mode 3 (prm1n2 = 1, prm1n1 = 1, prm1n0 = 0) in mode 3, when two signals 90 degrees out of phase are input to the tiud1n and tcud1n pins, the level of the tcud1n pin is sampled at the input of the valid edge of the tiud1n pin (see figure 9- 23 ). if the tcud1n pin level sampled at the valid edge input to the tiud1n pin is low, tmenc1n counts down when the valid edge is input to the tiud1n pin. if the tcud1n pin level sampled at the valid edge input to the tiud1n pin is high, tmenc1n counts up when the valid edge is input to the tiud1n pin. figure 9-23. mode 3 (when rising edge is specified as valid edge of tiud1n pin) 0007h tiud1n tcud1n tmenc1n 0008h up count down count 0009h 000ah 0009h 0008h 0007h remark n = 0, 1 figure 9-24. mode 3 (when rising edge is specified as valid edge of tiud1n pin): in case of simultaneous tiud1n, tcud1n pin edge timing 0007h tiud1n tcud1n tmenc1n 0008h up count down count 0009h 000ah 0009h 0008h 0007h remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 468 preliminary user ? s manual u16031ej2v1ud (iv) mode 4 (prm1n2 = 1, prm1n1 = 1, prm1n0 = 1) in mode 4, when two signals out of phase are input to the tiud1n and tcud1n pins, up/down operation is automatically judged and counting is performed according to the timing shown in figure 9-25 . in mode 4, counting is executed at both the rising and falling edges of the two signals input to the tiud1n and tcud1n pins. therefore, tmenc1n counts four times per cycle of an input signal ( 4 count). figure 9-25. mode 4 up count tiud1n tcud1n tmenc1n 0004h 0003h 0006h 0005h 0008h 0007h 000ah 0009h 0008h 0009h 0006h 0007h 0005h down count cautions 1. when mode 4 is specified as the operation mode of tmenc1n, the valid edge specifications for the tiud1n and tcud1n pins are not valid. 2. if the tiud1n pin edge and tcud1n pin edge are input simultaneously in mode 4, tmenc1n continues the same count operation (up or down) it was performing immediately before the input. remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 469 (c) operation in udc mode a (i) interval operation the operations at the count clock following a match of the tmenc1n count value and the cm1n0 set value are as follows. ? in case of up count operation: tmenc1n is cleared to 0000h and the intcm1n0 interrupt is generated. ? in case of down count operation: the tmenc1n count value is decremented ( ? 1) and the intcm1n0 interrupt is generated. remark the interval operation can be combined with the transfer operation. (ii) transfer operation the operations at the next count clock after the count value of tmenc1n becomes 0000h during a tmenc1n count down operation are as follows. ? in case of down count operation: the data held in cm1n0 is transferred. ? in case of up count operation: the tmenc1n count value is incremented (+1). remarks 1. transfer enable/disable can be set using the rlen1n bit of the tmc1n register. 2. the transfer operation can be combined with the interval operation. figure 9-26. example of tmenc1n operation when interval operation and transfer operation are combined tmenc1n and cm1n0 match & timer clear tmenc1n underflow & cm1n0 data transfer tmenc1n count value cm1n0 set value up count down count 0000h remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) 470 preliminary user ? s manual u16031ej2v1ud (iii) compare function tmenc1n connects two compare register (cm1n0, cm1n1) channels and two capture/compare register (cc1n0, cc1n1) channels. when the tmenc1n count value and the set value of one of the compare registers match, a match interrupt (intcm1n0, intcm1n1, intcc1n0 note , intcc1n1 note ) is output. note this match interrupt is generated when cc1n0 and cc1n1 are set to the compare register mode. (iv) capture function tmenc1n connects two capture/compare register (cc1n0, cc1n1) channels. when cc1n0 and cc1n1 are set to the capture register mode, the value of tmenc1n is captured in synchronization with the corresponding capture trigger signal. when cc1n0 and cc1n1 are set to the capture register mode, a capture interrupt (intcc1n0, intcc1n1) is generated upon detection of the valid edge.
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 471 (d) operation in udc mode b (i) basic operation the operations at the next count clock after the count value of tmenc1n and the cm1n0 set value match when tmenc1n is in udc mode b are as follows. ? in case of up count operation: tmenc1n is cleared to 0000h and the intcm1n0 interrupt is generated. ? in case of down count operation: the tmenc1n count value is decremented ( ? 1). the operations at the next count clock after the count value of tmenc1n and the cm1n1 set value match when tmenc1n is in udc mode b are as follows. ? in case of up count operation: the tmenc1n count value is incremented (+1). ? in case of down count operation: tmenc1n is cleared to 0000h and the intcm1n1 interrupt is generated. figure 9-27. example of tmenc1n operation in udc mode cm1n0 set value cm1n1 set value tmenc1n count value clear tmenc1n not cleared if count clock counts down following match clear tmenc1n not cleared if count clock counts up following match remark n = 0, 1 (ii) compare function tmenc1n connects two compare register (cm1n0, cm1n1) channels and two capture/compare register (cc1n0, cc1n1) channels. when the tmenc1n count value and the set value of one of the compare registers match, a match interrupt (intcm1n0 (only during up count operation), intcm1n1 (only during down count operation), intcc1n0 note , intcc1n1 note ) is output. note this match interrupt is generated when cc1n0 and cc1n1 are set to the compare register mode. (iii) capture function tmenc1n connects two capture/compare register (cc1n0, cc1n1) channels. when cc1n0 and cc1n1 are set to the capture register mode, the value of tmenc1n is captured in synchronization with the corresponding capture trigger signal. when cc1n0 and cc1n1 are set to the capture register mode, a capture interrupt (intcc1n0, intcc1n1) is generated upon detection of the valid edge.
chapter 9 timer/counter function (real-time pulse unit) 472 preliminary user ? s manual u16031ej2v1ud 9.3.7 supplementary description of internal operation (1) clearing of count value in udc mode b when tmenc1n is in udc mode b, the count value clear operation is as follows. ? in case of tmenc1n up count operation: tmenc1n is cleared upon match with cm1n0 ? in case of tmenc1n down count operation: tmenc1n is cleared upon match with cm1n1 figure 9-28. clear operation upon match with cm1n0 during tmenc1n up count operation count clock (rising edge set as valid edge) cm1n0 fffeh tmenc1n cleared (tmenc1n not cleared) tmenc1n ffffh 0000h (fffeh) 0001h (fffdh) ffffh up count up count (down count) remarks 1. n = 0, 1 2. the items in parentheses in the above figure apply to down count operations. figure 9-29. clear operation upon match with cm1n1 during tmenc1n down count operation count clock (rising edge set as valid edge) cm1n1 00ffh tmenc1n cleared (tmenc1n not cleared) tmenc1n 00feh 0000h (00ffh) ffffh (0100h) 00feh up count down count (up count) remarks 1. n = 0, 1 2. the items in parentheses in the above figure apply to up count operations.
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 473 (2) clearing of count value upon occurrence of compare match the internal operation during a tmenc1n clear operation upon occurrence of a compare match is as follows. figure 9-30. count value clear operation upon compare match count clock (rising edge set as valid edge) cm1n0 fffeh tmenc1n cleared (tmenc1n not cleared) tmenc1n ffffh 0000h (fffeh) 0001h (fffdh) ffffh up count up count (down count) caution the operations at the next count clock after the count value of tmenc1n and the cm1n0 set value match are as follows. ? in case of up count: clear operation is performed. ? ? ? ? in case of down count: clear operation is not performed. remarks 1. n = 0, 1 2. the items in parentheses in the above figure apply to down count operations. (3) transfer operation the internal operation during tmenc1n transfer operation is as follows. figure 9-31. internal operation during transfer operation count clock (rising edge set as valid edge) cm1n0 0001h transfer operation performed (transfer operation not performed) tmenc1n 0000h ffffh (0001h) fffeh (0002h) ffffh down count down count (up count) caution the count operations after the tmenc1n count value becomes 0000h are as follows. ? ? ? ? in case of down count: transfer operation is performed. ? ? ? ? in case of up count: transfer operation is not performed. remarks 1. n = 0, 1 2. the items in parentheses in the above figure apply to up count operations.
chapter 9 timer/counter function (real-time pulse unit) 474 preliminary user ? s manual u16031ej2v1ud (4) interrupt signal output upon compare match an interrupt signal is output when the count value of tmenc1n matches the set value of the cm1n0, cm1n1, cc1n0 note , or cc1n1 note register. the interrupt generation timing is as follows. note when cc1n0 and cc1n1 are set to the compare register mode. figure 9-32. interrupt output upon compare match (cm1n1 with operation mode set to general-purpose timer mode and count clock set to f x /8) count clock f x /4 cm1n1 0007h tmenc1n internal match signal intcm1n1 0008h 000bh 0009h 0009h 000ah remark n = 0, 1 an interrupt signal such as the one illustrated in figure 9-32 is output at the next count following a match of the tmenc1n count value and the set value of the corresponding compare register. (5) ubd1n flag (bit 0 of status1n register) operation in the udc mode (t1cmdn bit of tum1n register = 1), the ubd1n flag changes as follows during tmenc1n up/down count operation at every internal operation clock. figure 9-33. ubd1n flag operation count clock ubd1n 0001h 0000h tmenc1n 0000h 0001h 0001h 0000h remark n = 0, 1
chapter 9 timer/counter function (real-time pulse unit) preliminary user ? s manual u16031ej2v1ud 475 (6) overflow interrupt signal (intov1n) and underflow interrupt signal (intud1n) (a) the overflow interrupt signal (intov1n) is generated when the count value of tmenc1n has reached ffffh and the next count operation is an up-count. (b) the underflow interrupt signal (intud1n) is generated when the count value of tmenc1n has reached 0000h and the next count operation is a down-count. (c) tmenc1n continues counting even after occurrence of an overflow or underflow, if a count edge is detected. if the condition of the underflow (0000h ffffh) is satisfied when the rlen1n bit of the tmc1n register is 1 (enabling transfer), however, the set value of cm1n0 is transferred. (d) if the condition of the underflow (0000h ffffh) is satisfied with cm1n0 = ffffh when the rlen1n bit of the tmc1n register is cleared to 0 (disabling transfer), the intcm1n0 interrupt and intud1n interrupt occur simultaneously.
preliminary user?s manual u16031ej2v1ud 476 chapter 10 serial interface function 10.1 features the serial interface function provides three types of serial interfaces equipped with five transmit/receive channels of which four channels can be used simultaneously. the following three interface formats are available. (1) asynchronous serial interfaces b0 and b1 (uartb0 and uartb1): 2 channels (2) clocked serial interfaces 30 and 31 (csi30 and csi31): 2 channels (3) usb function controller (usbf): 1 channel remark for details of the usb function, see chapter 11 usb function controller (usbf) . uartb0 and uartb1, which use the method of transmitting/receiving one byte of serial data following a start bit, enable full-duplex communication to be performed. csi30 and csi31 transfer data according to three types of signals (3-wire serial i/o). these signals are the serial clock (sck0 and sck1), serial input (si0 and si1), and serial output (so0 and so1) signals. the usb supports full-speed transfer of 12 mbps and consists of seven endpoints. 10.1.1 switching between uartb0 and csi30 modes in the v850e/me2, since uartb0 and csi30 are alternate function pins, they cannot be used at the same time. the registers must be set in advance.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 477 10.2 asynchronous serial interfaces b0, b1 (uartb0, uartb1) 10.2.1 features ? transfer rate: maximum 1.5 mbps (using a dedicated baud rate generator) ? full-duplex communications ? single mode and fifo mode selectable ? single mode: 8-bit 1-stage data register (ubntx register or ubnrx register) is used for each of transmission and reception. ? fifo mode transmit fifon: ubntx register (8 bits 16 stages). receive fifon: ubnrxap register (16 bits 16 stages) 2 bits of the higher 8 bits of the ubnrxap register are for an error flag. ? two-pin configuration txdn: transmit data output pin rxdn: receive data input pin ? reception error detection function ? overflow error (fifo mode only) ? parity error ? framing error ? overrun error (single mode only) ? interrupt sources: 5 types ? reception error interrupt (ubtiren) ? reception completion interrupt (ubtirn) ? transmission completion interrupt (ubtitn) ? fifo transmission completion interrupt (ubtifn) (fifo mode only) ? reception timeout interrupt (ubtiton) (fifo mode only) ? the character length of transmit/receive data is specified according to the ubnctl0 register ? character length: 7 or 8 bits ? parity functions: odd, even, 0, or none ? transmission stop bits: 1 or 2 bits ? msb first/lsb first selectable for transfer data ? on-chip dedicated baud rate generator remark n = 0, 1
chapter 10 serial interface function 478 preliminary user?s manual u16031ej2v1ud 10.2.2 configuration uartbn is controlled by uartbn control register 0 (ubnctl0), the uartbn status register (ubnstr), uartbn control register 2 (ubnctl2), uartbn fifo control register 0 (ubnfic0), uartbn fifo control register 1 (ubnfic1), uartbn fifo control register 2 (ubnfic2), uartbn fifo status register 0 (ubnfis0), and uartbn fifo status register 1 (ubnfis1) (n = 0, 1). receive data is stored in a receive data register (the ubnrx register in the single mode or receive fifon in the fifo mode (the ubnrxap register)) and transmit data is written to a transmit data register (the ubntx register in the single mode or transmit fifon in the fifo mode). if a reception error (such as a parity error or a framing error) occurs in the fifo mode, the error data can be identified by reading uartbn receive data register ap (ubnrxap) in 16-bit (halfword) units. figure 10-1 shows the configuration of the asynchronous serial interface. (1) uartbn control register 0 (ubnctl0) (n = 0, 1) this register controls the transfer operation of uartbn. (2) uartbn status register (ubnstr) (n = 0, 1) this register indicates the transfer status during transmission and the contents of a reception error. the status flag of this register, which indicates the transfer status during transmission, indicates the data retention status of transmit shift register n and transmit data register n (the ubntx register in the single mode or transmit fifon in the fifo mode). each reception error flag is set to 1 when a reception error occurs, and cleared to 0 when 0 is written to the ubnstr register. (3) uartbn control register 2 (ubnctl2) (n = 0, 1) this register is used to specify the division rate by which to control the baud rate (serial transfer speed) of uartbn. (4) uartbn fifo control register 0 (ubnfic0) (n = 0, 1) this register is used to select the operation mode of uartbn, clear the transmit fifon/receive fifon that becomes valid in the fifo mode, and specify the timing mode in which the transmission completion interrupt (ubtitn)/reception completion interrupt (ubtirn) occurs. (5) uartbn fifo control register 1 (ubnfic1) (n = 0, 1) this register is valid in the fifo mode. it generates a reception timeout interrupt request (ubtiton) if data is stored in the receive fifon when the next data does not come (start bit is not detected) even after the reception wait time of the next data has elapsed. (6) uartbn fifo control register 2 (ubnfic2) (n = 0, 1) this register is valid in the fifo mode. it is used to set the timing to generate the transmission completion interrupt (ubtitn)/reception completion interrupt (ubtirn), using the number of data transmitted or received as a trigger. (7) uartbn fifo status register 0 (ubnfis0) (n = 0, 1) this register is valid in the fifo mode. the number of bytes of data stored in the receive fifo can be read from this register. (8) uartbn fifo status register 1 (ubnfis1) (n = 0, 1) this register is valid in the fifo mode. the number of vacant bytes of the transmit fifon can be read from this register.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 479 (9) receive shift register n (n = 0, 1) this is a shift register that converts the serial data that was input to the rxdn pin into parallel data. one byte of data is received, and if a stop bit is detected, the received data is transferred to receive data register n. this register cannot be directly manipulated. (10)uartbn receive data register ap (ubnrxap), uartbn receive data register (ubnrx) (n = 0, 1) receive data register n holds receive data. in the single mode, the 8-bit 1-stage ubnrx register is used. the 16-bit 16-stage receive fifon (ubnrxap register) is used in the fifo mode. the receive data is stored in the lower 8 bits of the receive fifon (ubnrxap register) and the error information of the received data is stored in the higher 8 bits (bit 8 and bit 9). if a reception error (such as a parity error or a framing error) occurs in the fifo mode, the error data can be identified by reading the ubnrxap register in 16-bit (halfword) units (error information is appended as ubnpef bit = 1 or ubnfef bit = 1). when the lower 8 bits of the ubnrxap register are read in 8-bit (byte) units, the higher 8 bits are discarded. therefore, if no error has occurred, the receive data of the ubnrxap register can be read consecutively by being read in 8-bit (byte) units in the same way as the ubnrx register. when 7-bit length data is received with the lsb first, the received data is transferred to bits 6 to 0 of receive data register n from the lsb (bit 0), with the msb (bit 7) always being 0. when data is received with the msb first, the received data is transferred to bits 7 to 1 of receive data register n from the msb (bit 7), with the lsb (bit 0) always being 0. if an overrun error occurs, the receive data at that time is not transferred to receive data register n. while reception is enabled, the received data is transferred from receive shift register n to receive data register n, in synchronization with the shift-in processing of one frame. a reception completion interrupt request (ubtirn) is generated by transferring the data to the ubnrx register in the single mode, or transferring the number of receive data set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register to receive fifon in the fifo mode. if data is stored in receive fifon when the next data does not come (start bit is not detected) after the next data reception wait time specified by the ubntc4 to ubntc0 bits of the ubnfic1 register has elapsed in the fifo mode, a reception timeout interrupt request (ubtiton) is generated. (11)transmit shift register n (n = 0, 1) this is a shift register that converts the parallel data that was transferred from transmit data register n into serial data. when one byte of data is transferred from transmit data register n, transmit shift register n data is output from the txdn pin. this register cannot be directly manipulated.
chapter 10 serial interface function 480 preliminary user?s manual u16031ej2v1ud (12)uartbn transmit data register n (ubntx) (n = 0, 1) transmit data register n is a buffer for transmit data. the 8-bit 1-stage ubntx register is used as this buffer in the single mode. in the fifo mode, the 8-bit 16-stage transmit fifon is used. when 7-bit length data is transmitted with the lsb first, bits 6 to 0 of transmit data register n are transmitted as the transmit data from the lsb (bit 0) with the msb (bit 7) always being 0. when data is transmitted with the msb first, bits 7 to 1 of transmit data register n are transmitted as the transmit data from the msb (bit 7) with the lsb (bit 0) always being 0. in the single mode, transmission is started by writing transmit data to the ubntx register while transmission is enabled (ubntxe bit = 1 in the ubnctl0 register). when writing the transmit data to the ubntx register is enabled (when 1-byte data is transferred from the ubntx register to transmit shift register n), a transmission completion interrupt request (ubtitn) is generated. in the fifo mode, transmission is started by writing at least the number of transmit data set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register and 16 bytes or less to transmit fifon and then enabling transmission (ubntxe bit = 1). when the number of transmit data set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register have been transferred from transmit fifon to transmit shift register n (transmit data of the number set as the trigger can be written), a transmission completion interrupt request (ubtitn) is generated. in the fifo mode, a fifo transmission completion interrupt request (ubtifn) is generated when there is no more data in transmit fifon and transmit shift register n (when fifon and the register become empty). (13)timeout counter this counter is used to recognize that data exists (remains) in receive fifon when the number of received data does not reach the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register, and is valid only in the fifo mode. if data is stored in receive fifon when the next data does not come (start bit is not detected) after the next data reception wait time specified by the ubntc4 to ubntc0 bits of the ubnfic1 register has elapsed after the stop bit has been received, a reception timeout interrupt request (ubtiton) is generated.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 481 (14)sampling block this block samples the rxdn signal at the rising edge of the input clock (f x /4) (f x : main clock). if the same sampling value is detected two times, output of the match detector changes, and the value is sampled as input data. data of less than one clock width is judged as noise and is not transmitted to the internal circuitry. figure 10-1. block diagram of asynchronous serial interfaces b0 and b1 rxdn internal bus receive shift register n uartbn control register 0 (ubnctl0) uartbn control register 2 (ubnctl2) uartbn status register (ubnstr) uartbnfifo control register 0 (ubnfic0) uartbnfifo control register 1 (ubnfic1) uartbnfifo control register 2 (ubnfic2) uartbnfifo status register 0 (ubnfis0) uartbnfifo status register 1 (ubnfis1) ubnrx receive fifon timeout counter sampling block receive controller transmit controller baud rate generator n reception unit transmission unit baud rate generator n transmit shift register n ubntx transmit fifon ubtiton txdn ubtifn ubtitn ubtirn ubtiren f x /4 remarks 1. n = 0, 1 2. f x : main clock
chapter 10 serial interface function 482 preliminary user ? s manual u16031ej2v1ud 10.2.3 control registers (1) uartbn control register 0 (ubnctl0) (n = 0, 1) the ubnctl0 register controls the transfer operations of uartbn. this register can be read or written in 8-bit or 1-bit units. cautions 1. when using uartbn, set the external pins related to the uartbn function in the control mode, set uartbn control register 2 (ubnctl2). then set the ubnpwr bit to 1 before setting the other bits. 2. be sure to input a high level to the rxdn pin when setting the external pins related to the uartbn function in the control mode. if a low level is input, it is judged that a falling edge is input after the ubnrxe bit has been set to 1, and reception may be started. (1/3) ub0pwr ub1pwr ub0ctl0 ub1ctl0 ub0txe ub1txe 5 ub0rxe ub1rxe ub0dir ub1dir 3 ub0ps1 ub1ps1 2 ub0ps0 ub1ps0 1 ub0cl ub1cl ub0sl ub1sl address fffffa00h fffffa20h after reset 10h 10h 0 4 6 7 bit position bit name function 7 ubnpwr controls the operation clock. 0: stops supply of clocks to uartbn 1: supplies clocks to uartbn cautions 1. when the ubnpwr bit is cleared to 0, the uartbn can be asynchronously reset. 2. when ubnpwr = 0, the uartbn is in a reset state. therefore, to operate uartbn, the ubnpwr bit must be set to 1. 3. when the ubnpwr bit is changed from 1 to 0, all registers of the uartbn are initialized. when the ubnpwr is set to 1 again, the uartbn registers must be set again. the txdn pin output is high level when the ubnpwr bit is cleared to 0. 6ubntxe specifies whether transmission is enabled or disabled. 0: transmission is disabled 1: transmission is enabled cautions 1. on startup, set ubnpwr to 1 and then set ubntxe to 1. to stop transmission, clear ubntxe to 0 and then ubnpwr to 0. 2. when the transmission unit status is to be initialized, the transmission status may not be able to be initialized unless the ubntxe bit is set to 1 again after an interval of two cycles of f x /4 (f x : main clock) has elapsed since the ubntxe bit was cleared to 0. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 483 (2/3) bit position bit name function 5 ubnrxe specifies whether reception is enabled or disabled. 0: reception is disabled 1: reception is enabled cautions 1. on startup, set ubnpwr to 1 and then set ubnrxe to 1. to stop reception, clear ubnrxe to 0 and then ubnpwr to 0. 2. when the reception unit status is to be initialized, the reception status may not be able to be initialized unless the ubnrxe bit is set to 1 again after an interval of two cycles of f x /4 (f x : main clock) has elapsed since the ubnrxe bit was cleared to 0. 4 ubndir specifies the transfer direction mode (msb/lsb). 0: the first bit of transfer data is the msb. 1: the first bit of transfer data is the lsb. caution before changing the setting of the ubndir bit, clear the ubnpwr bit or ubntxe and ubnrxe bits to 0. controls the parity bit. ubnps1 ubnps0 transmit operation receive operation 0 0 do not output a parity bit receive with no parity 0 1 output 0 parity receive as 0 parity 1 0 output odd parity judge as odd parity 1 1 output even parity judge as even parity 3, 2 ubnps1, ubnps0 cautions 1. to overwrite the ubnps1 and ubnps0 bits, first clear the ubntxe and ubnrxe bits to 0. 2. if ?0 parity? is selected for reception, no parity judgement is made. therefore, no error interrupt is generated because the ubnpe bit of the ubnstr register is not set to 1. ? even parity if the transmit data contains an odd number of bits with the value ? 1 ? , the parity bit is set to 1. if it contains an even number of bits with the value ? 1 ? , the parity bit is cleared to 0. this controls the number of bits with the value ? 1 ? contained in the transmit data and the parity bit so that it is an even number. during reception, the number of bits with the value ? 1 ? contained in the receive data and the parity bit is counted, and if the number is odd, a parity error is generated. ? odd parity in contrast to even parity, odd parity controls the number of bits with the value ? 1 ? contained in the transmit data and the parity bit so that it is an odd number. during reception, the number of bits with the value ? 1 ? contained in the receive data and the parity bit is counted, and if the number is even, a parity error is generated. remark n = 0, 1
chapter 10 serial interface function 484 preliminary user ? s manual u16031ej2v1ud (3/3) bit position bit name function 3, 2 ubnps1, ubnps0 ? 0 parity during transmission, the parity bit is cleared to 0 regardless of the transmit data. during reception, no parity error is generated because no parity bit is checked. ? no parity no parity bit is added to transmit data. during reception, the receive data is considered to have no parity bit. no parity error is generated because there is no parity bit. 1 ubncl specifies the character length of the transmit/receive data. 0: 7 bits 1: 8 bits caution to overwrite the ubncl bit, first clear the ubntxe and ubnrxe bits to 0. 0 ubnsl specifies the stop bit length of the transmit data. 0: 1 bit 1: 2 bits cautions 1. to overwrite the ubnsl bit, first clear the ubntxe bit to 0. 2. since reception always operates by using a single stop bit length, the ubnsl bit setting does not affect receive operations. remarks 1. when reception is disabled, receive shift register n does not detect a start bit. no shift-in processing or transfer processing to receive data register n is performed, and the contents of receive data register n are retained. when reception is enabled, the receive shift operation starts, in synchronization with the detection of the start bit, and when the reception of one frame is completed, the contents of receive shift register n are transferred to receive data register n. a reception completion interrupt (ubtirn) is also generated, in synchronization with the transfer to receive data register n (in fifo mode, transfer triggered by reaching set number of receive data). if data is stored in receive fifon when the next data does not come (start bit is not detected) after the next data reception wait time specified by the ubntc4 to ubntc0 bits of the ubnfic1 register has elapsed in the fifo mode, a reception timeout interrupt request (ubtiton) is generated. 2. n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 485 (2) uartbn status register (ubnstr) (n = 0, 1) the ubnstr register indicates the transfer status and reception error contents while uartbn is transmitting data. the status flag that indicates the transfer status during transmission indicates the data retention status of transmit shift register n and transmit data register n (the ubntx register in the single mode or transmit fifon in the fifo mode). the status flag that indicates a reception error holds its status until it is cleared to 0. this register can be read or written in 8-bit or 1-bit units. caution when the ubnpwr bit or ubnrxe bit of the ubnctl0 register is cleared to 0, or when 0 is written to the ubnstr register, the ubnovf, ubnpe, ubnfe, and ubnove bits of the ubnstr register are cleared to 0. (1/2) ub0tsf ub1tsf ub0str ub1str 0 0 5 0 0 0 0 3 ub0ovf ub1ovf 2 ub0pe ub1pe 1 ub0fe ub1fe ub0ove ub1ove address fffffa04h fffffa24h after reset 00h 00h 0 4 6 7 bit position bit name function 7 ubntsf this is a status flag indicating the transfer status. ? in single mode (ubnmod bit = 0 in the ubnfic0 register) 0: data to be transferred to transmit shift register n and ubntx register does not exist (cleared (0) when ubnpwr bit = 0 or ubntxe bit = 0 in the ubnctl0 register). 1: data to be transferred to transmit shift register n or ubntx register exists (transmission in progress). ? in fifo mode (ubnmod bit = 1 in the ubnfic0 register) 0: data to be transferred to transmit shift register n and transmit fifon does not exist (cleared (0) when ubnpwr bit = 0 or ubntxe bit = 0 in the ubnctl0 register). 1: data to be transferred to transmit shift register n and transmit fifon exists (transmission in progress). caution the value of the ubntsf bit is reflected after two periods of f x /4 (f x : main clock) have elapsed, after the transmit data is written to the ubntx register. therefore, exercise care when referencing the ubntsf bit after transmit data has been written to the ubntx register. 3 ubnovf this is a status flag indicating an overflow. the setting of this flag is valid only in the fifo mode (when ubnmod bit = 1 in the ubnfic0 register), and invalid in the single mode (when ubnmod bit = 0 in the ubnfic0 register). 0: overflow did not occur. 1: overflow occurred (during reception). caution if an overflow occurs, the received data is not written to receive fifon but discarded. remark n = 0, 1
chapter 10 serial interface function 486 preliminary user ? s manual u16031ej2v1ud (2/2) bit position bit name function 2 ubnpe this is a status flag that indicates a parity error. the setting of this flag is valid only in the single mode (when ubnmod bit = 0 in the ubnfic0 register), and invalid in the fifo mode (when ubnmod bit = 1 in the ubnfic0 register). 0: parity error did not occur. 1: parity error occurred (during reception). caution the operation of the ubnpe bit differs according to the settings of the ubnps1 and ubnps0 bits of the ubnctl0 register. 1 ubnfe this is a status flag that indicates a framing error. the setting of this flag is valid only in the single mode (when ubnmod bit = 0 in the ubnfic0 register), and invalid in the fifo mode (when ubnmod bit = 1 in the ubnfic0 register). 0: framing error did not occur. 1: framing error occurred (during reception). caution for receive data stop bits, only the first bit is checked regardless of the stop bit length. 0ubnove this is a status flag that indicates an overrun error. the setting of this flag is valid only in the single mode (when ubnmod bit = 0 in the ubnfic0 register), and invalid in the fifo mode (when ubnmod bit = 1 in the ubnfic0 register). 0: overrun error did not occur. 1: overrun error occurred (during reception). caution when an overrun error occurs, the next receive data value is not written to the ubnrx register and the data is discarded. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 487 (3) uartbn control register 2 (ubnctl2) (n = 0, 1) the ubnctl2 register is used to specify the division ratio by which to control the baud rate (serial transfer speed) of uartbn. this register can be read or written in 16-bit units. caution when rewriting the ubnbrs15 to ubnbrs0 bits of this register, clear the ubntxe and ubnrxe bits of the ubnctl0 register to 0 or clear the ubnpwr bit (n = 0, 1). 14 ub0 brs 14 13 ub0 brs 13 12 ub0 brs 12 2 ub0 brs 2 3 ub0 brs 3 4 ub0 brs 4 5 ub0 brs 5 6 ub0 brs 6 7 ub0 brs 7 8 ub0 brs 8 9 ub0 brs 9 10 ub0 brs 10 11 ub0 brs 11 15 ub0 brs 15 1 ub0 brs 1 0 ub0 brs 0 ub0ctl2 address fffffa02h after reset ffffh ub1 brs 14 ub1 brs 13 ub1 brs 12 ub1 brs 2 ub1 brs 3 ub1 brs 4 ub1 brs 5 ub1 brs 6 ub1 brs 7 ub1 brs 8 ub1 brs 9 ub1 brs 10 ub1 brs 11 ub1 brs 15 ub1 brs 1 ub1 brs 0 ub1ctl2 fffffa22h ffffh bit position bit name function 15 to 0 ubnbrs15 to ubnbrs0 specify the division value of the 16-bit counter (see table 10-1 ). remark n = 0, 1 table 10-1. division value of 16-bit counter ubnb rs15 ubnb rs14 ubnb rs13 ubnb rs12 ubnb rs11 ubnb rs10 ubnb rs9 ubnb rs8 ubnb rs7 ubnb rs6 ubnb rs5 ubnb rs4 ubnb rs3 ubnb rs2 ubnb rs1 ubnb rs0 k output clock selected 00000000000000xx 4 f x /(4 k) 0000000000000100 4 f x /(4 k) 0000000000000101 5 f x /(4 k) 0000000000000110 6 f x /(4 k) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 111111111111110065,532f x /(4 k) 111111111111110165,533f x /(4 k) 111111111111111065,534f x /(4 k) 111111111111111165,535f x /(4 k) remarks 1. f x : main clock 2. k: value set by ubnbrs15 to ubnbrs0 bits of ubnctl2 register (k = 4, 5, 6, ? , 65,535) 3. x: don ? t care
chapter 10 serial interface function 488 preliminary user?s manual u16031ej2v1ud (4) uartbn transmit data register (ubntx) (n = 0, 1) the ubntx register is used to set transmit data. it functions as the 8-bit 1-stage ubntx register, in the single mode (ubnmod bit = 0 in the ubnfic0 register), and as the 8-bit 16-stage transmit fifon in the fifo mode (ubnmod bit = 1 in the ubnfic0 register). in the single mode, transmission is started by writing transmit data to the ubntx register when transmission is enabled (the ubntxe bit = 1 in the ubnctl0 register). when data can be written to the ubntx register (when 1 byte of data is transferred from the ubntx register to transmit shift register n), a transmission completion interrupt request (ubtitn) is generated. in the fifo mode, transmission is started by enabling transmission (ubntxe bit = 1) after writing at least the number of transmit data set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register and 16 bytes or less to transmit fifon. when the number of transmit data set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register have been transferred from transmit fifon to transmit shift register n (transmit data of the number set as the trigger can be written to transmit fifon), a transmission completion interrupt request (ubtitn) is generated. in the fifo mode, a fifo transmission completion interrupt request (ubtifn) is generated when there is no more data in transmit fifon and transmit shift register n (when the fifon and register become empty). for the generation timing of the interrupt, see 10.2.4 interrupt requests . when 7-bit length data is transmitted with the lsb first, bits 6 to 0 of transmit data register n are transmitted as the transmit data from the lsb (bit 0) with the msb (bit 7) always being 0. when data is transmitted with the msb first, bits 7 to 1 of transmit data register n are transmitted as the transmit data from the msb (bit 7) with the lsb (bit 0) always being 0. this register is write-only, in 8-bit units. data is written to transmit data register n. ub0td7 ub1td7 ub0tx ub1tx ub0td6 ub1td6 5 ub0td5 ub1td5 ub0td4 ub1td4 3 ub0td3 ub1td3 2 ub0td2 ub1td2 1 ub0td1 ub1td1 ub0td0 ub1td0 address fffffa08h fffffa28h after reset ffh ffh 0 4 6 7 bit position bit name function 7 to 0 ubntd7 to ubntd0 write transmit data. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 489 (5) uartbn receive data register ap (ubnrxap), uartbn receive data register (ubnrx) (n = 0, 1) these registers store parallel data converted by receive shift register n. they function as the 8-bit 1-stage ubnrx register, in the single mode (ubnmod bit = 0 in the ubnfic0 register), and as the 16-bit 16-stage receive fifon (ubnrxap register) in the fifo mode (ubnmod bit = 1 in the ubnfic0 register). the receive data is stored in the lower 8 bits of the receive fifon (ubnrxap register) and the error information of the received data is stored in the higher 8 bits (bit 8 and bit 9). if a reception error (such as a parity error or a framing error) occurs in the fifo mode, the ubnrxap register is read in 16-bit (halfword) units. in this way, the flag of the data stored in receive fifon can be checked (error information is appended as ubnpef bit = 1 or ubnfef bit = 1), so that the error data can be recognized (when the lower 8 bits of the ubnrxap register are read in 8-bit (byte) units, the higher 8 bits are discarded. therefore, if no error has occurred, the receive data of the ubnrxap register can be read consecutively by being read in 8-bit (byte) units in the same way as the ubnrx register). if reception is enabled (ubnrxe bit = 1 in the ubnctl0 register), the receive data is transferred from receive shift register n to receive data register n, in synchronization with the completion of the shift-in processing of one frame. by transferring the receive data to the ubnrx register in the single mode or by transferring the number of receive data set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register to the receive fifon in the fifo mode, a reception completion interrupt request (ubtirn) is generated. if data is stored in receive fifon when the next data does not come (start bit is not detected) even after the next data reception wait time specified by the ubntc4 to ubntc0 bits of the ubnfic1 register has elapsed in the fifo mode, a reception timeout interrupt request (ubtiton) is generated. for information about the timing for generating these interrupt requests, see 10.2.4 interrupt requests . if data is received with the lsb first when the data length is specified as 7 bits, the received data is transferred to bits 6 to 0 of receive data register n from the lsb (bit 0), with the msb (bit 7) always being 0. if data is received with the msb first, it is transferred to bits 7 to 1 of receive data register n from the msb (bit 7) with the lsb (bit 0) always being 0. however, if an overrun error occurs, the receive data at that time is not transferred to receive data register n. the ubnrxap register is read-only, in 16-bit units. however, the lower 8 bits of the ubnrxap register are read-only, in 8-bit units. the ubnrx register is read-only, in 8-bit units. in addition to reset input, the value of these registers can be set to ffh in the single mode or to 00ffh in the fifo mode, by clearing the ubnpwr bit of the ubnctl0 register to 0. cautions 1. because these registers serve as 8-bit registers in the single mode, the ubnpef and ubnfef bits cannot be read. 2. when no reception error has occurred in the fifo mode, the receive data of the ubnrxap register can be read consecutively by reading the lower 8 bits of the ubnrxap register in 8-bit (byte) units. an 8-bit access to the higher 8 bits is prohibited. if they are accessed, the operation is not guaranteed.
chapter 10 serial interface function 490 preliminary user ? s manual u16031ej2v1ud 14 0 13 0 12 0 2 ub0 rd2 3 ub0 rd3 4 ub0 rd4 5 ub0 rd5 6 ub0 rd6 7 ub0 rd7 8 ub0 fef 9 ub0 pef 10 0 11 0 15 0 1 ub0 rd1 0 ub0 rd0 ub0rxap address fffffa06h after reset 00ffh 000 ub1 rd2 ub1 rd3 ub1 rd4 ub1 rd5 ub1 rd6 ub1 rd7 ub1 fef ub1 pef 0 0 0 ub1 rd1 ub1 rd0 ub1rxap fffffa26h 00ffh [uartbn receive data register ap] [uartbn receive data register] 2 ub0 rd2 3 ub0 rd3 4 ub0 rd4 5 ub0 rd5 6 ub0 rd6 7 ub0 rd7 1 ub0 rd1 0 ub0 rd0 ub0rx address fffffa06h after reset ffh ub1 rd2 ub1 rd3 ub1 rd4 ub1 rd5 ub1 rd6 ub1 rd7 ub1 rd1 ub1 rd0 ub1rx fffffa26h ffh bit position bit name function 9 (ubnrxap) ubnpef this is a status flag that indicates a parity error. status is valid only in the fifo mode (ubnmod bit = 1 in the ubnfic0 register), and is invalid in the single mode (ubnmod bit = 0 in the ubnfic0 register). 0: no parity error 1: parity error occurs (during reception). caution the operation of the ubnpef bit differs depending on the set values of the ubnps1 and ubnps0 bits of the ubnctl0 register. 8 (ubnrxap) ubnfef this is a status flag indicating a framing error. status is valid only in the fifo mode (ubnmod bit = 1 in the ubnfic0 register), and is invalid in the single mode (ubnmod bit = 0 in the ubnfic0 register). 0: no framing error 1: framing error occurs (during reception). caution only the first bit of the stop bits of the receive data is checked, regardless of the stop bit length. 7 to 0 ubnrd7 to ubnrd0 stores receive data. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 491 (6) uartbn fifo control register 0 (ubnfic0) (n = 0, 1) the ubnfic0 register is used to select the operation mode of uartbn and the functions that become valid in the fifo mode (ubnmod bit = 1). in the fifo mode, it clears transmit fifon/receive fifon and specifies the timing mode in which the transmission completion interrupt (ubtitn)/reception completion interrupt (ubtirn) is generated. this register can be read or written in 8-bit or 1-bit units. (1/2) ub0mod ub1mod ub0fic0 ub1fic0 5 0 0 0 0 3 ub0tfc ub1tfc 2 ub0rfc ub1rfc 1 ub0itm ub1itm ub0irm ub1irm address fffffa0ah fffffa2ah after reset 00h 00h 0 4 6 0 0 7 bit position bit name function 7 ubnmod specifies an operation mode of uartbn. 0: single mode 1: fifo mode 3 ubntfc this is a transmit fifon clear trigger bit. the setting of this bit is valid only in the fifo mode (ubnmod bit = 1) and invalid in the single mode (ubnmod bit = 0). 0: normal status 1: clear (this bit automatically returns to 0 after transmit fifon is cleared.) when 1 is written to the ubntfc bit, the pointer to transmit fifon is cleared to 0. in the pending mode (ubnitm bit = 0), the interrupt request (ubtitn) held pending is cleared note . however, bit 7 (utifn) of the interrupt control register (uticn) is not cleared to 0. clear this bit to 0 as necessary. when 0 is written to the ubntfc bit, the status is retained. no operation, such as clearing or setting, is executed. note after transmit fifon is cleared (ubntfc bit = 1), accessing the registers related to uartb is prohibited for the duration of four cycles of f x /4 (f x : main clock) or until clearing the ubntfc bit (automatic recovery) is confirmed by reading the ubnfic0 register. if these registers are accessed, the operation is not guaranteed. caution when writing 1 to the ubntfc bit, be sure to clear the ubntxe bit of the ubnctl0 register to 0 (disabling transmission). if 1 is written to the ubntfc bit when the ubntxe bit is 1 (transmission enabled), the operation is not guaranteed. remark n = 0, 1
chapter 10 serial interface function 492 preliminary user ? s manual u16031ej2v1ud (2/2) bit position bit name function 2 ubnrfc this is a receive fifon (ubnrxap) clear trigger bit. the setting of this bit is valid only in the fifo mode (ubnmod bit = 1) and invalid in the single mode (ubnmod bit = 0). 0: normal status 1: clear (this bit automatically returns to 0 after receive fifon is cleared.) when 1 is written to the ubnrfc bit, the pointer to receive fifon is cleared to 0. in the pending mode (ubnirm bit = 0), the interrupt request (ubtirn) held pending is cleared note . however, bit 7 (urifn) of the interrupt control register (uricn) is not cleared to 0. clear this bit to 0 as necessary. when 0 is written to the ubnrfc bit, the status is retained. no operation, such as clearing or setting, is executed. note after receive fifon (ubnrxap) is cleared (ubnrfc bit = 1), accessing the registers related to uartb is prohibited for the duration of four cycles of f x /4 (f x : main clock) or until clearing the ubnrfc bit (automatic recovery) is confirmed by reading the ubnfic0 register. if these registers are accessed, the operation is not guaranteed. caution when writing 1 to the ubnrfc bit, be sure to clear the ubnrxe bit of the ubnctl0 register to 0 (disabling reception). if 1 is written to the ubnrfc bit when the ubnrxe bit is 1 (reception enabled), the operation is not guaranteed. 1 ubnitm this bit specifies the timing mode in which the ubtitn interrupt is generated in fifo mode. 0: pending mode 1: pointer mode in the fifo mode, the ubtitn interrupt is generated as soon as transmit data of the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register have been transferred from transmit fifon to transmit shift register n. after the ubtitn interrupt request has been generated, specify the timing of actually generating the ubtitn interrupt as the pending mode or pointer mode. for details, refer to 10.2.5 (2) pending mode/pointer mode . 0ubnirm this bit specifies the timing mode in which the ubtirn interrupt is generated in fifo mode. 0: pending mode 1: pointer mode in the fifo mode, the ubtirn interrupt is generated as soon as receive data of the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register have been transferred from receive shift register n to receive fifon. after the ubtirn interrupt request has been generated, specify the timing of actually generating the ubtirn interrupt as the pending mode or pointer mode. for details, refer to 10.2.5 (2) pending mode/pointer mode . remark n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 493 (7) uartbn fifo control register 1 (ubnfic1) (n = 0, 1) the ubnfic1 register is valid in the fifo mode (ubnmod bit = 1 in the ubnfic0 register). it generates a reception timeout interrupt request (ubtiton) if data is stored in receive fifon when the next data does not come (start bit is not detected) after the lapse of the time set by the ubntc4 to ubntc0 bits (next data reception wait time), after the stop bit has been received. this register can be read or written in 8-bit or 1-bit units. ub0tce ub1tce ub0fic1 ub1fic1 5 0 0 ub0tc4 ub1tc4 3 ub0tc3 ub1tc3 2 ub0tc2 ub1tc2 1 ub0tc1 ub1tc1 ub0tc0 ub1tc0 address fffffa0bh fffffa2bh after reset 00h 00h 0 4 6 0 0 7 bit position bit name function 7 ubntce specifies the timeout counter function. 0: disable use of timeout counter function. 1: enable use of timeout counter function. specify the time to wait for the next data reception. ubn tc4 ubn tc3 ubn tc2 ubn tc1 ubn tc0 next data reception wait time 0 0 0 0 0 32 bytes (32 8 / baud rate) 0 0 0 0 1 31 bytes (31 8 / baud rate) 0 0 0 1 0 30 bytes (30 8 / baud rate) 0 0 0 1 1 29 bytes (29 8 / baud rate) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 111004 bytes (4 8 / baud rate) 111013 bytes (3 8 / baud rate) 111102 bytes (2 8 / baud rate) 111111 byte (1 8 / baud rate) 4 to 0 ubntc4 to ubntc0 caution when the count set by the ubntc4 to ubntc0 bits is up, the count value of the timeout counter is cleared to 0, regardless of the status of the data stored in receive fifon. when the next start bit is later detected, counting is started again from the stop bit of that data. remark n = 0, 1
chapter 10 serial interface function 494 preliminary user ? s manual u16031ej2v1ud (8) uartbn fifo control register 2 (ubnfic2) (n = 0, 1) the ubnfic2 register is valid in the fifo mode (ubnmod bit = 1 in the ubnfic0 register). it sets the timing of generating an interrupt, using the number of transmit/receive data as a trigger. when data is transmitted, the number of data transferred from transmit fifon is specified as the condition of generating the interrupt. when data is received, the number of data stored in receive fifon is specified as the interrupt generation condition. this register can be read or written in 16-bit units. when the higher 8 bits of the ubnfic2 register can be used as the ubnfic2h register and the lower 8 bits, as the ubnfic2l register, these registers can be read or written in 8-bit units. caution before writing data to the ubnfic2 register, be sure to clear the ubntxe bit (to disable transmission) and ubnrxe bit (to disable reception) of the ubnctl0 register to 0. if data is written to the ubnfic2 register with the ubntxe or ubnrxe bit set to 1, the operation is not guaranteed.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 495 (1/2) 14 0 13 0 12 0 2 ub0 rt2 3 ub0 rt3 4 0 5 0 6 0 7 0 8 ub0 tt0 9 ub0 tt1 10 ub0 tt2 11 ub0 tt3 15 0 1 ub0 rt1 0 ub0 rt0 ub0fic2 address fffffa0ch after reset 0000h 000 ub1 rt2 ub1 rt3 0 0 0 0 ub1 tt0 ub1 tt1 ub1 tt2 ub1 tt3 0 ub1 rt1 ub1 rt0 ub1fic2 fffffa2ch 0000h bit position bit name function set the number of transmit fifon transmit data to be the trigger. each time data of the specified number has shifted out from transmit fifon to transmit shift register n, the ubtitn interrupt is generated. in the pending mode (ubnitm bit = 0 in the ubnfic0 register), the ubtitn interrupt is generated under the conditions of the pending mode. ubn tt3 ubn tt2 ubn tt1 ubn tt0 number of data of transmit fifon set as trigger pointer mode pending mode 0 0 0 0 1 byte settable 00012 bytes 00103 bytes 00114 bytes 01005 bytes 01016 bytes 01107 bytes 01118 bytes 10009 bytes 100110 bytes 101011 bytes 101112 bytes 110013 bytes 110114 bytes 111015 bytes 111116 bytes setting prohibited settable 11 to 8 ubntt3 to ubntt0 caution in the pointer mode (ubnitm bit = 1 in the ubnfic0 register), the number of transmit data set as the trigger can be only 1 byte (ubntt3 to ubntt0 bits = 0000), and other settings are prohibited. if a setting of other than 1 byte is made, the operation is not guaranteed. remark n = 0, 1
chapter 10 serial interface function 496 preliminary user ? s manual u16031ej2v1ud (2/2) bit position bit name function set the number of receive fifon receive data to be the trigger. each time data of the specified number has been stored from receive shift register n to receive fifon, the ubtir interrupt is generated. in the pending mode (ubnitm bit = 0 in the ubnfic0 register), the ubtirn interrupt is generated under the conditions of the pending mode. ubn rt3 ubn rt2 ubn rt1 ubn rt0 number of data of receive fifon set as trigger pointer mode pending mode 0 0 0 0 1 byte settable 00012 bytes 00103 bytes 00114 bytes 01005 bytes 01016 bytes 01107 bytes 01118 bytes 10009 bytes 100110 bytes 101011 bytes 101112 bytes 110013 bytes 110114 bytes 111015 bytes 111116 bytes setting prohibited settable 3 to 0 ubnrt3 to ubnrt0 caution in the pointer mode (ubnirm bit = 1 in the ubnfic0 register), the number of receive data set as the trigger can be only 1 byte (ubnrt3 to ubnrt0 bits = 0000), and other settings are prohibited. if a setting of other than 1 byte is made, the operation is not guaranteed. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 497 (9) uartbn fifo status register 0 (ubnfis0) (n = 0, 1) the ubnfis0 register is valid in the fifo mode (ubnmod bit = 1 in the ubnfic0 register). it is used to read the number of bytes of the data stored in receive fifon. this register is read-only, in 8-bit units. 0 0 ub0fis0 ub1fis0 5 0 0 ub0rb4 ub1rb4 3 ub0rb3 ub1rb3 2 ub0rb2 ub1rb2 1 ub0rb1 ub1rb1 ub0rb0 ub1rb0 address fffffa0eh fffffa2eh after reset 00h 00h 0 4 6 0 0 7 bit position bit name function indicates the number of bytes (readable bytes) of the data stored in receive fifon as a receive fifon pointer. ubn rb4 ubn rb3 ubn rb2 ubn rb1 ubn rb0 receive fifon pointer 000000 bytes 000011 byte 000102 bytes 000113 bytes 001004 bytes 001015 bytes 001106 bytes 001117 bytes 010008 bytes 010019 bytes 0101010 bytes 0101111 bytes 0110012 bytes 0110113 bytes 0111014 bytes 0111115 bytes 1000016 bytes other than above invalid 4 to 0 ubnrb4 to ubnrb0 remark n = 0, 1
chapter 10 serial interface function 498 preliminary user ? s manual u16031ej2v1ud (10)uartbn fifo status register 1 (ubnfis1) (n = 0, 1) the ubnfis1 register is valid in the fifo mode (ubnmod bit = 1 in the ubnfic0 register). this register can be used to read the number of vacant bytes of transmit fifon. this register is read-only, in 8-bit units. caution the values of the ubntb4 to ubntb0 bits are reflected after transmit data has been written to the ubntx register and then time of two cycles of f x /4 (f x : main clock) has passed. therefore, care must be exercised when referencing the ubnfis1 register after transmit data has been written to the ubntx register. 0 0 ub0fis1 ub1fis1 5 0 0 ub0tb4 ub1tb4 3 ub0tb3 ub1tb3 2 ub0tb2 ub1tb2 1 ub0tb1 ub1tb1 ub0tb0 ub1tb0 address fffffa0fh fffffa2fh after reset 10h 10h 0 4 6 0 0 7 bit position bit name function indicates the number of vacant bytes of transmit fifon (bytes that can be written) as a transmit fifon pointer. ubn tb4 ubn tb3 ubn tb2 ubn tb1 ubn tb0 transmit fifon pointer 000000 bytes 000011 byte 000102 bytes 000113 bytes 001004 bytes 001015 bytes 001106 bytes 001117 bytes 010008 bytes 010019 bytes 0101010 bytes 0101111 bytes 0110012 bytes 0110113 bytes 0111014 bytes 0111115 bytes 1000016 bytes other than above invalid 4 to 0 ubntb4 to ubntb0 remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 499 10.2.4 interrupt requests the following five types of interrupt requests are generated from uartbn (n = 0, 1). ? reception error interrupt (ubtiren) ? reception completion interrupt (ubtirn) ? transmission completion interrupt (ubtitn) ? fifo transmission completion interrupt (ubtifn) ? reception timeout interrupt (ubtiton) the default priorities among these five types of interrupt requests is, from high to low, reception error interrupt, reception completion interrupt, transmission completion interrupt, fifo transmission completion interrupt, and reception timeout interrupt. table 10-2. generated interrupts and default priorities interrupt priority reception error 1 reception completion 2 transmission completion 3 fifo transmission completion 4 reception timeout 5 (1) reception error interrupt (ubtiren) (a) single mode when reception is enabled, a reception error interrupt is generated according to the logical or of the three types of reception errors (parity error, framing error, overrun error) explained for the ubnstr register. when reception is disabled, no reception error interrupt is generated. (b) fifo mode when reception is enabled, a reception error interrupt is generated according to the logical or of the three types of reception errors (parity error, framing error, overflow error) explained for the ubnstr register. when reception is disabled, no reception error interrupt is generated.
chapter 10 serial interface function 500 preliminary user?s manual u16031ej2v1ud (2) reception completion interrupt (ubtirn) (a) single mode when reception is enabled, a reception completion interrupt is generated if data is shifted into receive shift register n and stored in the ubnrx register (if the receive data can be read). when reception is disabled, no reception completion interrupt is generated. (b) fifo mode when reception is enabled, a reception completion interrupt is generated if data is shifted into receive shift register n and receive data of the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register is transferred to receive fifon (if receive data of the specified number can be read). when reception is disabled, no reception completion interrupt is generated. (3) transmission completion interrupt (ubtitn) (a) single mode the transmission completion interrupt is generated if transmit data of one frame, including 7 or 8 bits of characters, is shifted out from transmit shift register n and the ubntx register becomes vacant (if transmit data can be written). (b) fifo mode the transmission completion interrupt is generated if transmit data of the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register is transferred to transmit shift register n from transmit fifon (if transmit data of the specified number can be written). (4) fifo transmission completion interrupt (ubtifn) (a) single mode cannot be used. (b) fifo mode the fifo transmission completion interrupt is generated when no more data is in transmit fifon and transmit shift register n (when the fifo and register become empty). after the fifo transmission completion interrupt has occurred, clear the interrupt held pending (ubtitn) in the pending mode (ubnitm bit = 0 in the ubnfic0 register) by clearing the fifo (ubntfc bit = 1 in the ubnfic0 register). caution if the fifo transmission completion interrupt is generated (all transmit data are not transmitted) because writing the next transmit data to transmit fifon is delayed, do not clear the fifo.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 501 (5) reception timeout interrupt (ubtiton) (a) single mode cannot be used. (b) fifo mode the reception timeout interrupt is generated if data is stored in receive fifon when the next data does not come (start bit is not detected) even after the next data reception wait time specified by the ubntc4 to ubntc0 bits of the ubnfic1 register has elapsed, when the timeout counter function is used (ubntce bit = 1 in the ubnfic1 register). the reception timeout interrupt is not generated while reception is disabled. if receive data of the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register is not received, the timing of reading the number of receive data less than the specified number can be set by the reception timeout interrupt. since the timeout counter starts counting at start bit detection, a receive timeout interrupt does not occur if data of 1 character has not been received.
chapter 10 serial interface function 502 preliminary user?s manual u16031ej2v1ud 10.2.5 control method (1) single mode/fifo mode the single mode or fifo mode can be selected by using the ubnmod bit of the ubnfic0 register. (a) single mode ? each of the ubnrx and ubntx registers consists of 8 bits 1 stage. ? when 1 byte of data is received, the ubtirn interrupt is generated. ? if the next reception operation of uartbn is completed before the receive data of the ubnrx register is read after the ubtirn interrupt has been generated, the ubtiren interrupt is generated and an overrun error occurs. (b) fifo mode ? receive fifon (ubnrxap register) consists of 16 bits 16 stages and transmit fifon consists of 8 bits 16 stages. ? receive fifon can recognize error data by reading the 16-bit ubnrxap register only when a reception error (parity error or framing error) occurs. ? transmission is started when transmission is enabled (ubntxe bit = 1 in the ubnctl0 register) after transmit data of at least the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register and 16 bytes or less are written to transmit fifon. ? the pending mode or pointer mode can be selected for the generation timing of the ubtitn and ubtirn interrupts.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 503 (2) pending mode/pointer mode the pending mode or pointer mode can be selected by using the ubnitm and ubnirm bits of the ubnfic0 register in the fifo mode (ubnmod bit = 1 in the ubnfic0 register). if transmission is started by writing data of more than double the amount set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register to transmit fifon, the transmission completion interrupt (ubtitn) may occur more than once. the reception completion interrupt (ubtirn) may also occur more than once if the number of receive data set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register is 8 bytes or less in receive fifon. in the pending or pointer mode, it can be specified how an interrupt is handled after it has been held pending. (a) pending mode (i) during transmission (writing to transmit fifon) ? if the data of the first transmission completion interrupt (ubtitn) is not written to transmit fifon after the interrupt has occurred, the second ubtitn interrupt does not occur (is held pending) even if the generation condition of the second ubtitn interrupt is satisfied (when transmit data of the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register is transferred from transmit fifon to the transmit shift register). when data for the first ubtitn interrupt is later written to transmit fifon, the pending ubtitn interrupt is generated note . note the number of pending interrupts is as follows. when trigger is set to 1 byte (ubntt3 to ubntt0 bits of ubnfic2 register = 0000): 15 times max. when trigger is set to 2 bytes (ubntt3 to ubntt0 bits of ubnfic2 register = 0001): 7 times max. : when trigger is set to 6 bytes (ubntt3 to ubntt0 bits of ubnfic2 register = 0101): 1 time max. when trigger is set to 7 bytes (ubntt3 to ubntt0 bits of ubnfic2 register = 0110): 1 time max. when trigger is set to 8 bytes (ubntt3 to ubntt0 bits of ubnfic2 register = 0111): 1 time max. ? in the pending mode, transmit data of the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register is always written to transmit fifon when the transmission completion interrupt (ubtitn) occurs. writing data to transmit fifon is prohibited if the data is more or less than the specified number. if data more or less than the specified number is written, the operation is not guaranteed. ? to write transmit data to transmit fifon by dma, fix the ubntt3 to ubntt0 bits of the ubnfic2 register to 0000 (set number of transmit data: 1 byte). if any other setting is made, the operation is not guaranteed.
chapter 10 serial interface function 504 preliminary user ? s manual u16031ej2v1ud (ii) during reception (reading from receive fifon) ? if data for the first reception completion interrupt (ubtirn) is not read from receive fifon, the second ubtirn interrupt does not occur (is held pending) even if the generation condition of the second ubtirn is satisfied (if receive data of the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register can be read from receive fifon). when data for the first ubtirn interrupt is later read from the receive fifon, the pending ubtirn interrupt is generated note . note the number of pending interrupts is as follows. when trigger is set to 1 byte (ubnrt3 to ubnrt0 bits of ubnfic2 register = 0000): 15 times max. when trigger is set to 2 bytes (ubnrt3 to ubnrt0 bits of ubnfic2 register = 0001): 7 times max. : when trigger is set to 6 bytes (ubnrt3 to ubnrt0 bits of ubnfic2 register = 0101): 1 time max. when trigger is set to 7 bytes (ubnrt3 to ubnrt0 bits of ubnfic2 register = 0110): 1 time max. when trigger is set to 8 bytes (ubnrt3 to ubnrt0 bits of ubnfic2 register = 0111): 1 time max. ? in the pending mode, receive data of the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register is always read from receive fifon when the reception completion interrupt (ubtirn) occurs. reading data from receive fifon is prohibited if the data is more or less than the specified number. if data more or less than the specified number is read, the operation is not guaranteed. ? to read receive data from receive fifon by dma, fix the ubnrt3 to ubnrt0 bits of the ubnfic2 register to 0000 (set number of receive data: 1 byte). if any other setting is made, the operation is not guaranteed. (b) pointer mode (i) during transmission (writing to transmit fifon) ? each time the data of 1 byte is transferred to transmit shift register n from transmit fifon, a transmission completion interrupt (ubtitn) occurs. ? in the pointer mode, be sure to fix the ubntt3 to ubntt0 bits of the ubnfic2 register to 0000 (set number of transmit data: 1 byte) as the number of transmit data set as the trigger for transmit fifon when the transmission completion interrupt (ubtitn) occurs. if any other setting is made, the operation is not guaranteed. ? writing transmit data to transmit fifon by dma is prohibited. the operation is not guaranteed if dma control is used. ? after the transmission completion interrupt (ubtitn) has been acknowledged, data of the number of vacant bytes of transmit fifon can be written to transmit fifon by referencing the ubnfis1 register.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 505 (ii) during reception (reading from receive fifon) ? each time the data of 1 byte is transferred to receive fifon from receive shift register n, a reception completion interrupt (ubtirn) occurs. ? in the pointer mode, be sure to fix the ubnrt3 to ubnrt0 bits of the ubnfic2 register to 0000 (set number of receive data: 1 byte) as the number of receive data set as the trigger for receive fifon when the reception completion interrupt (ubtirn) occurs. if any other setting is made, the operation is not guaranteed. ? reading receive data from receive fifon by dma is prohibited. the operation is not guaranteed if dma control is used. ? after the reception completion interrupt (ubtirn) has been acknowledged, data of the number of bytes stored in receive fifon can be read from receive fifon by referencing the ubnfis0 register. in some cases, however, data is not stored in receive fifon even though the ubtirn interrupt is generated (ubnrb4 to ubnrb0 bits = 00000 in the ubnfis0 register). in these cases, do not read data from receive fifon. always read data from receive fifon when the number of bytes stored in receive fifon is 1 byte or more (ubnrb4 to ubnrb0 bits = other than 00000). 10.2.6 operation (1) data format full-duplex serial data transmission and reception can be performed. the transmit/receive data format consists of one data frame containing a start bit, character bits, a parity bit, and stop bits as shown in figure 10-2. the character bit length within one data frame, the type of parity, and the stop bit length are specified by the uartbn control register 0 (ubnctl0) (n = 0, 1). also, data is transferred with lsb first/msb first. figure 10-2. asynchronous serial interface transmit/receive data format (lsb-first transfer) 1 data frame start bit d0 d1 d2 d3 d4 d5 d6 d7 parity bit stop bits character bits ? start bit 1 bit ? character bits 7 bits or 8 bits ? parity bit even parity, odd parity, 0 parity, or no parity ? stop bits 1 bit or 2 bits
chapter 10 serial interface function 506 preliminary user ? s manual u16031ej2v1ud (2) transmit operation in the single mode (ubnmod bit = 0 in the ubnfic0 register), transmission is enabled when the ubntxe bit of the ubnctl0 register is set to 1, and transmission is started when transmit data is written to the ubntx register (n = 0, 1). in the fifo mode (ubnmod bit = 1 in the ubnfic0 register), transmission is started when transmit data of at least the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register and 16 bytes or less is written to transmit fifon and then the ubntxe bit is set to 1. caution setting the ubntxe bit of the ubnctl0 register to 1 before writing transmit data to transmit fifon in the fifo mode is prohibited. the operation is not guaranteed if this setting is made. (a) transmission enabled state this state is set by the ubntxe bit in the ubnctl0 register (n = 0, 1). ? ubntxe = 1: transmission enabled state ? ubntxe = 0: transmission disabled state however, when the transmission enabled state is set, to use uartb0, which shares pins with clocked serial interface 30 (csi30), the csicae0 bit of clocked serial interface mode register 30 (csim30) should be cleared to 0. since uartbn does not have a cts (transmission enabled signal) input pin, a port should be used to confirm whether the destination is in the reception enabled state. (b) starting a transmit operation ? ? ? ? in single mode (ubnmod bit = 0 in ubnfic0 register) in the single mode, transmission is started when transmit data is written to the ubntx register while transmission is enabled (n = 0, 1). ? ? ? ? in fifo mode (ubnmod bit = 1 in ubnfic0 register) in the fifo mode, transmission is started when transmit data of at least the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register and 16 bytes or less is written to transmit fifon and then transmission is enabled (ubntxe bit = 1). data in transmit data register n (ubntx register in single mode or transmit fifon in the fifo mode) is transferred to transmit shift register n when transmission is started. then, transmit shift register n outputs data to the txdn pin sequentially beginning with the lsb (the transmit data is transferred sequentially starting with the start bit). the start bit, parity bit, and stop bits are added automatically (n = 0, 1).
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 507 (c) transmission interrupt request (i) transmission completion interrupt (ubtitn) ? ? ? ? in single mode (ubnmod bit = 0 in ubnfic0 register) in the single mode, the transmission completion interrupt (ubtitn) occurs when transmit data can be written to the ubntx register (when 1 byte of data is transferred from the ubntx register to transmit shift register n) (n = 0, 1). ? ? ? ? in fifo mode (ubnmod bit = 1 in ubnfic0 register) in the fifo mode, the ubtitn interrupt occurs when transmit data of the number set as the trigger specified by the ubntt3 to ubntt0 bits of the ubnfic2 register is transferred from transmit fifon to transmit shift register n (if transmit data of the number set as the trigger can be written) (n = 0, 1). ? ? ? ? if pending mode is specified (ubnitm bit = 0 in ubnfic0 register) in fifo mode if the pending mode is specified in the fifo mode, the second ubtitn interrupt is held pending after the first ubtitn interrupt has occurred, until as many transmit data as the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register are written to transmit fifon, even if the generation condition of the second ubtitn interrupt is satisfied. when as many transmit data as the number set as the trigger are written to transmit fifon in response to the first ubtitn interrupt, the second pending ubtitn interrupt is generated (n = 0, 1). ? ? ? ? if pointer mode is specified (ubnitm bit = 1 in ubnfic0 register) in fifo mode if the pointer mode is specified in the fifo mode, the second ubtitn interrupt occurs when the generation condition of the second ubtitn interrupt is satisfied even if as many transmit data as the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register are not written to transmit fifon when the first ubtitn interrupt occurs (n = 0, 1). (ii) fifo transmission completion interrupt (ubtifn) the fifo transmission completion interrupt (ubtifn) occurs when no more data is in transmit fifon and transmit shift register n in the fifo mode (ubnmod bit = 1 in the ubnfic0 register) (n = 0, 1). after the ubtifn interrupt has occurred, clear the pending ubtitn interrupt in the pending mode (ubnitm bit = 0 in the ubnfic0 register) by clearing the fifo (ubntfc bit = 1 in the ubnfic0 register). if the ubtifn interrupt occurs because writing the next transmit data to transmit fifon is delayed (if all transmit data have not been transmitted), do not clear the fifo. if the data to be transmitted next has not been written to transmit data register n, the transmit operation is suspended. caution in the single mode, the transmission completion interrupt (ubtitn) occurs when the ubntx register becomes empty (when 1 byte of data is transferred from the ubntx register to transmit shift register n). in the fifo mode, the fifo transmission completion interrupt (ubtifn) occurs when data is no longer in transmit fifon and transmit shift register n (when the fifo and register are vacant). however, the ubtitn interrupt or ubtifn interrupt is not generated if transmit data register n becomes empty due to reset input.
chapter 10 serial interface function 508 preliminary user ? s manual u16031ej2v1ud figure 10-3. timing of asynchronous serial interface transmission completion interrupt (ubtitn) start stop d0 d1 d2 d6 d7 parity txdn (output) ubtitn (output) remarks 1. in the fifo mode, the ubtitn interrupt occurs at the above timing when as many transmit data as the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register are serially transferred. 2. n = 0, 1 figure 10-4. timing of asynchronous serial interface fifo transmission completion interrupt (ubtifn) start stop d0 d1 d2 d6 d7 parity txdn (output) ubtifn (output) remarks 1. the ubtifn interrupt occurs at the above timing when data is no longer in transmit fifon and transmit shift register n (when the fifo and register are vacant). 2. n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 509 (3) continuous transmission operation ? ? ? ? in single mode (ubnmod bit = 0 in ubnfic0 register) in the single mode, the next data can be written to the ubntx register as soon as transmit shift register n has started a shift operation (n = 0, 1). the timing of transfer can be identified by the transmission completion interrupt (ubtitn). by writing the next transmit data to the ubntx register via the ubtitn interrupt within one data frame transmission period, data can be transmitted without an interval and an efficient communication rate can be realized. caution before executing initialization during transmission processing, confirm that the ubntsf bit of the ubnstr register is 0. if initialization is executed while the ubntsf bit is 1, the transmit data is not guaranteed. ? ? ? ? if pending mode is specified (ubnitm bit = 0 in ubnfic0 register) in fifo mode if transmit data of at least the number set as the transmit trigger by ubntt3 to ubntt0 bits of the ubnfic2 register and 16 bytes or less is written to transmit fifon, transmission starts. if the pending mode is specified in the fifo mode, as many of the next transmit data as the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register can be written to transmit fifon as soon as transmit shift register n has started shifting the last data of the specified number of data. the timing of transfer can be identified by the ubtitn interrupt. by writing as many of the next transmit data as the number set as the trigger to transmit fifon or writing the data to the fifo within the transmission period of the data in transmit fifon via the ubtitn interrupt, data can be transmitted without an interval and an efficient communication rate can be realized. caution before executing initialization during transmission processing, confirm that the ubntsf bit of the ubnstr register is 0 (this can also be done by the fifo transmission completion interrupt (ubtifn)). if initialization is executed while the ubntsf bit is 1, the transmit data is not guaranteed. to write transmit data to transmit fifon by dma, set the number of transmit data specified as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register to 1 byte. otherwise, the operation will not be guaranteed. ? ? ? ? if pointer mode is specified (ubnitm bit = 1 in ubnfic0 register) in fifo mode if the pointer mode is specified in the fifo mode, a ubtitn interrupt occurs and the next data can be written to transmit fifon as soon as transmit shift register n has started shifting the number of transmit data set as the trigger. at this time, as many data as the number of vacant bytes of transmit fifon can be written by referencing the ubnfis1 register. the timing of transfer can be identified by the ubtitn interrupt. by writing as many of the next transmit data as the number specified as the trigger to transmit fifon (= 1 byte) or writing the data to the fifo within the transmission period of the data in transmit fifon via the ubtitn interrupt, data can be transmitted without an interval and an efficient communication rate can be realized. caution before executing initialization during transmission processing, confirm that the ubntsf bit of the ubnstr register is 0 (this can also be done by the fifo transmission completion interrupt (ubtifn)). if initialization is executed while the ubntsf bit is 1, the transmit data is not guaranteed.
chapter 10 serial interface function 510 preliminary user?s manual u16031ej2v1ud (4) receive operation the awaiting reception state is set by setting the ubnpwr bit to 1 in the ubnctl0 register and then setting ubnrxe to 1 in the ubnctl0 register (n = 0, 1). rxdn pin sampling begins and a start bit is detected. when the start bit is detected, the receive operation begins, and data is stored sequentially in receive shift register n according to the baud rate that was set. in the single mode (ubnmod bit = 0 in the ubnfic0 register), a reception completion interrupt (ubtirn) is generated each time the reception of one frame of data is completed. normally, the receive data is transferred from the ubnrx register to memory by this interrupt servicing. in the fifo mode (ubnmod bit = 1 in the ubnfic0 register), the ubtirn interrupt occurs when as many receive data as the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register are transferred to receive fifon. if the pending mode is specified (ubnirm bit = 0 in the ubnfic0 register) in the fifo mode, as many receive data as the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register can be read from receive fifon. if the pointer mode is specified (ubnirm bit = 1 in the ubnfic0 register) in the fifo mode, as many data as the number of bytes stored in receive fifon (0 bytes or more) can be read from receive fifon by referencing the number of receive data specified as the trigger by the ubnrt3 to ubnrt0 bits (1 byte) or the ubnfis0 register. caution if the pointer mode is specified in the fifo mode and if as many data as the number of bytes stored in receive fifon are read by referencing the ubnfis0 register, no data may be stored in receive fifon (ubnrb4 to ubnrb0 bits = 00000 in the ubnfis0 register) even though the reception completion interrupt (ubtirn) has occurred. in this case, do not read data from receive fifon. be sure to read data from receive fifon after confirming that the number of bytes stored in receive fifon = 1 byte or more (ubnrb4 to ubnrb0 bits = other than 00000). (a) reception enabled state this state is set by the ubnrxe bit in the ubnctl0 register (n = 0, 1). ? ubnrxe = 1: reception enabled state ? ubnrxe = 0: reception disabled state however, when the reception enabled state is set, to use uartb0, which shares pins with clocked serial interface 30 (csi30), the operation of csi30 must be disabled by clearing the csicae0 bit of clocked serial interface mode register 30 (csim30) to 0 (n = 0, 1). in the reception disabled state, the reception hardware stands by in the initial state. at this time, the reception completion interrupt or reception error interrupt does not occur, and the contents of receive data register n (ubnrx register in the single mode or receive fifon in the fifo mode (ubnrxap register)) are retained. (b) starting a receive operation a receive operation is started by the detection of a start bit. the rxdn pin is sampled using the serial clock from uartbn control register 2 (ubnctl2) (n = 0, 1).
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 511 (c) reception completion interrupt (i) reception completion interrupt (ubtirn) ? ? ? ? in single mode (ubnmod bit = 0 in ubnfic0 register) when ubnrxe bit = 1 in the ubnctl0 register and the reception of one frame of data is completed (the stop bit is detected) in the single mode, a reception completion interrupt request (ubtirn) is generated and the receive data in receive shift register n is transferred to the ubnrx register at the same time (n = 0, 1). also, if an overrun error occurs, the receive data at that time is not transferred to the ubnrx register, and a reception error interrupt (ubtiren) is generated. if a parity error or framing error occurs during the reception operation, the reception operation continues up to the position at which the stop bit is received. after completion of reception, an ubtiren interrupt occurs (the receive data in receive shift register n is transferred to the ubnrx register). if the ubnrxe bit is reset (0) during a receive operation, the receive operation is immediately stopped. at this time, the contents of the ubnrx register remain unchanged, the contents of the uartbn status register (ubnstr) are cleared, and the ubtirn and ubtiren interrupts do not occur. no ubtirn interrupt is generated when ubnrxe = 0 (reception is disabled). ? ? ? ? in fifo mode (ubnmod bit = 1 in ubnfic0 register) in the fifo mode, the reception completion interrupt (ubtirn) occurs when data of one frame has been received (stop bit is detected) and when as many receive data as the number specified as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register are transferred from receive shift register n to receive fifon (n = 0, 1). if an overflow error occurs, the receive data is not transferred to receive fifon and the reception error interrupt (ubtiren) occurs. if a parity error or framing error occurs during reception, reception continues up to the reception position of the stop bit. after reception has been completed, the ubtiren interrupt occurs and the receive data in receive shift register n is transferred to receive fifon. at this time, error information is appended as the ubnpef or ubnfef bit = 1 in the ubnrxap register. if the ubtiren interrupt occurs, the error data can be recognized by reading receive fifon as a 16-bit register, ubnrxap.
chapter 10 serial interface function 512 preliminary user?s manual u16031ej2v1ud (ii) reception timeout interrupt (ubtiton) (in fifo mode only) when the timeout counter function (ubntce bit = 1 in the ubnfic1 register) is used in the fifo mode, the reception timeout interrupt (ubtiton) occurs if the next data does not come even after the next data reception wait time specified by the ubntc4 to ubntc0 bits of the ubnfic1 register has elapsed and if data is stored in receive fifon (n = 0, 1). the ubtiton interrupt does not occur while reception is disabled. if as many receive data as the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register are not received, the timing of reading less receive data than the specified number can be set by the ubtiton interrupt. since the timeout counter starts counting at start bit detection, a receive timeout interrupt does not occur if data of 1 character has not been received. figure 10-5. timing of asynchronous serial interface reception completion interrupt (ubtirn) start d0 d1 d2 d6 d7 rxdn (input) ubtirn (output) receive data register n parity stop cautions 1. be sure to read all the data (the number of data indicated by the ubnrb4 to ubnrb0 bits of the ubnfis0 register) stored in receive data register n (ubnrx register in the single mode or receive fifon in the fifo mode (ubnrxap register)) even when a reception error occurs. unless receive data register n is read, an overrun error occurs when the next data is received, causing the reception error status to persist. if the pending mode is specified in the fifo mode, however, be sure to clear the fifo (ubnrfc bit = 1 in the ubnfic0 register) after reading the data stored in receive fifon. in the fifo mode, the fifo can be cleared even without reading the data stored in receive fifon. if a parity error or framing error occurs in the fifo mode, the ubnrxap register can be read in 16-bit (halfword) units. 2. data is always received with one stop bit. a second stop bit is ignored. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 513 (5) reception error in the single mode (ubnmod bit = 0 in the ubnfic0 register), the three types of errors that can occur during a receive operation are a parity error, framing error, and overrun error. in the fifo mode (ubnmod bit = 1 in the ubnfic0 register), the three types of errors that can occur during a receive operation are a parity error, framing error, and overflow error. as a result of data reception, the ubnpe, ubnfe, or ubnove bit of the ubnstr register is set to 1 if a parity error, framing error, or overrun error occurs in the single mode. the ubnovf bit of the ubnstr register is set to 1 if an overflow error occurs in the fifo mode. the ubnpef or ubnfef bit of the ubnrxap register is set to 1 if a parity error or framing error occurs in the fifo mode. at the same time, a reception error interrupt (ubtiren) occurs. the contents of the error can be detected by reading the contents of the ubnstr or ubnrxap register. the contents of the ubnstr register are reset when 0 is written to the ubnovf, ubnpe, ubnfe, or ubnove bit, or the ubnpwr or ubnrxe bit of the ubnctl0 register. the contents of the ubnrxap register are reset when 0 is written to the ubnpwr bit of the ubnctl0 register. table 10-3. reception error causes error flag valid operation mode error flag reception error cause ubnpe ubnpe parity error the parity specification during transmission does not match the parity of the receive data ubnfe ubnfe framing error no stop bit detected ubnove single mode ubnove overrun error the reception of the next data is completed before data is read from the ubnrx register ubnovf ubnovf overflow error the reception of the next data is completed while receive fifon is full and before data is read. ubnpef ubnpef parity error the parity specification during transmission does not match the parity of the data to be received. ubnfef fifo mode ubnfef framing error the stop bit is not detected when the target data is loaded. remark n = 0, 1
chapter 10 serial interface function 514 preliminary user ? s manual u16031ej2v1ud (6) parity types and corresponding operation a parity bit is used to detect a bit error in communication data. normally, the same type of parity bit is used at the transmission and reception sides. (a) even parity (i) during transmission the parity bit is controlled so that the number of bits with the value ? 1 ? within the transmit data including the parity bit is even. the parity bit value is as follows. ? if the number of bits with the value ? 1 ? within the transmit data is odd: 1 ? if the number of bits with the value ? 1 ? within the transmit data is even: 0 (ii) during reception the number of bits with the value ? 1 ? within the receive data including the parity bit is counted, and a parity error is generated if this number is odd. (b) odd parity (i) during transmission in contrast to even parity, the parity bit is controlled so that the number of bits with the value ? 1 ? within the transmit data including the parity bit is odd. the parity bit value is as follows. ? if the number of bits with the value ? 1 ? within the transmit data is odd: 0 ? if the number of bits with the value ? 1 ? within the transmit data is even: 1 (ii) during reception the number of bits with the value ? 1 ? within the receive data including the parity bit is counted, and a parity error is generated if this number is even. (c) 0 parity during transmission the parity bit is set to ? 0 ? regardless of the transmit data. during reception, no parity bit check is performed. therefore, no parity error is generated regardless of whether the parity bit is ? 0 ? or ? 1 ? . (d) no parity no parity bit is added to the transmit data. during reception, the receive operation is performed as if there were no parity bit. since there is no parity bit, no parity error is generated.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 515 (7) receive data noise filter the rxdn signal is sampled at the rising edge of the input clock (f x /4) (f x : main clock). if the same sampling value is obtained twice, the match detector output changes, and this output is sampled as input data. therefore, data not exceeding one clock width is judged to be noise and is not delivered to the internal circuit (see figure 10-7 ). also, since the circuit is configured as shown in figure 10-6, internal processing during a receive operation is delayed by up to 2 clocks according to the external signal status. figure 10-6. noise filter circuit rxdn q f x /4 in ld_en q in internal signal a internal signal b match detector remarks 1. n = 0, 1 2. f x : main clock figure 10-7. timing of rxdn signal judged as noise internal signal a f x /4 rxdn (input) internal signal b match mismatch (judged as noise) mismatch (judged as noise) match remarks 1. n = 0, 1 2. f x : main clock
chapter 10 serial interface function 516 preliminary user?s manual u16031ej2v1ud 10.2.7 dedicated baud rate generators 0, 1 (brg0, brg1) a dedicated baud rate generator, which consists of a 16-bit programmable counter, generates serial clocks during transmission/reception in uartbn. the dedicated baud rate generator output can be selected as the serial clock for each channel. separate 16-bit counters exist for transmission and for reception. the baud rate for transmission/reception is the same at the same channel. (1) baud rate generator configuration figure 10-8. baud rate generator configuration clock 16-bit counter match detector baud rate ubnctl2: ubnbrs15 to ubnbrs0 1/2 ubnpwr, ubntxe (or ubnrxe) f x /4 remarks 1 .n = 0, 1 2. f x : main clock (a) base clock (clock) when ubnpwr bit = 1 in the ubnctl0 register, the input clock (f x /4) is supplied to the transmission/reception unit (f x : main clock). this clock is called the base clock. when ubnpwr = 0, the clock signal is fixed at low level.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 517 (2) serial clock generation a serial clock can be generated according to the settings of the ubnctl2 register (n = 0, 1). the 16-bit counter divisor value can be selected according to the ubnbrs15 to ubnbrs0 bits of the ubnctl2 register. (a) baud rate the baud rate is the value obtained according to the following formula. [bps] k 2 frequency clock base rate baud = base clock frequency = f x /4 (f x : main clock) k = value set according to ubnbrs15 to ubnbrs0 bits of ubnctl2 register (k = 4, 5, 6, ..., 65,535) (b) baud rate error the baud rate error is obtained according to the following formula. [%] 100 1 rate) baud (normal rate baud desired error) with rate (baud rate baud actual (%) error ? = ? ? ? ? ? ? ? ? cautions 1. make sure that the baud rate error during transmission does not exceed the allowable error of the reception destination. 2. make sure that the baud rate error during reception is within the allowable baud rate range during reception, which is described in paragraph (4). example: main clock (f x ) = 150 mhz = 150,000,000 hz settings of ubnbrs15 to ubnbrs0 bits in ubnctl2 register = 0000000001111010b (k = 122) target baud rate = 153,600 bps baud rate = 150 m/4/(2 122) = 150,000,000/4/(2 122) = 153,689 [bps] error = (153,689/153,600 ? 1) 100 = 0.058 [%]
chapter 10 serial interface function 518 preliminary user ? s manual u16031ej2v1ud (3) baud rate setting example table 10-4. baud rate generator setting data f x = 150 mhz f x = 133 mhz f x = 100 mhz f x = 80 mhz baud rate (bps) kerrkerrkerrkerr 300 62,500 0.000 55,417 ? 0.001 41,667 ? 0.001 33,333 0.001 600 31,250 0.000 27,708 0.001 20,833 0.002 16,667 ? 0.002 1,200 15,625 0.000 13,854 0.001 10,417 ? 0.003 8,333 0.004 2,400 7,813 ? 0.006 6,927 0.001 5,208 0.006 4,167 ? 0.008 4,800 3,906 0.006 3,464 ? 0.013 2,604 0.006 2,083 0.016 9,600 1,953 0.006 1,732 ? 0.013 1,302 0.006 1,042 ? 0.032 19,200 977 ? 0.045 866 ? 0.013 651 0.006 521 ? 0.032 31,250 600 0.000 532 0.000 400 0.000 320 0.000 38,400 488 0.058 433 ? 0.013 326 ? 0.147 260 0.160 76,800 244 0.058 216 0.218 163 ? 0.147 130 0.160 153,600 122 0.058 108 0.218 81 0.469 65 0.160 312,500 60 0.000 53 0.377 40 0.000 32 0.000 caution the maximum allowable frequency of the main clock (f x ) is 150 mhz. remark f x : main clock k: settings of ubnbrs15 to ubnbrs0 bits in ubnctl2 register (n = 0, 1) err: baud rate error [%]
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 519 (4) allowable baud rate range during reception the degree to which a discrepancy from the transmission destination ? s baud rate is allowed during reception is shown below. caution the equations described below should be used to set the baud rate error during reception so that it always is within the allowable error range. figure 10-9. allowable baud rate range during reception fl 1 data frame (11 fl) flmin flmax uartbn latch timing start bit bit 0 bit 1 bit 7 parity bit minimum allowable value maximum allowable value stop bit start bit bit 0 bit 1 bit 7 parity bit stop bit start bit bit 0 bit 1 bit 7 parity bit stop bit remark n = 0, 1 as shown in figure 10-9, after the start bit is detected, the receive data latch timing is determined according to the counter that was set by the ubnctl2 register. if all data up to the final data (stop bit) is in time for this latch timing, the data can be received normally. applying this to 11-bit reception is, theoretically, as follows. fl = (brate) ? 1 brate: uartbn baud rate (n = 0, 1) k: ubnctl2 setting value (n = 0, 1) fl: 1-bit data length latch timing margin: 2 clocks minimum allowable value: fl k 2 2 k 21 fl k 2 2 k fl 11 flmin + = ? ? =
chapter 10 serial interface function 520 preliminary user ? s manual u16031ej2v1ud therefore, the maximum baud rate that can be received at the transfer destination is as follows. brate 2 21k k 22 (flmin/11) brmax 1 + = = ? similarly, the maximum allowable value can be obtained as follows. fl k 2 2 k 21 fl k 2 2 k fl 11 flmax 11 10 ? = + ? = 11 fl k 20 2 k 21 flmax ? = therefore, the minimum baud rate that can be received at the transfer destination is as follows. brate 2 21k k 20 (flmax/11) brmin 1 ? = = ? the allowable baud rate error of uartbn and the transfer destination can be obtained as follows from the expressions described above for computing the minimum and maximum baud rate values. table 10-5. maximum and minimum allowable baud rate error division ratio (k) maximum allowable baud rate error minimum allowable baud rate error 4 +2.33 % ? 2.44 8 +3.53 % ? 3.61 16 +4.14 % ? 4.19 32 +4.45 % ? 4.48 64 +4.61 % ? 4.62 128 +4.68 % ? 4.69 256 +4.72 % ? 4.73 512 +4.74 % ? 4.74 1,024 +4.75 % ? 4.75 2,048 +4.76 % ? 4.76 4,096 +4.76 % ? 4.76 8,192 +4.76 % ? 4.76 16,384 +4.76 % ? 4.76 32,768 +4.76 % ? 4.76 65,535 +4.76 % ? 4.76 remarks 1. the reception precision depends on the number of bits in one frame, the base clock frequency, and the division ratio (k). the higher the base clock frequency and the larger the division ratio (k), the higher the precision. 2. k: ubnctl2 setting value (n = 0, 1)
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 521 (5) transfer rate during continuous transmission during continuous transmission, the transfer rate from a stop bit to the next start bit is extended two clocks longer than normal. however, on the reception side, the transfer result is not affected since the timing is initialized by the detection of the start bit. figure 10-10. transfer rate during continuous transmission start bit bit 0 bit 1 bit 7 parity bit stop bit fl 1 data frame bit 0 fl fl fl fl fl fl flstp start bit of second byte start bit representing the 1-bit data length by fl, the stop bit length by flstp, and the base clock frequency by f x /4 (f x : main clock) yields the following equation. flstp = fl + 2/(f x /4) therefore, the transfer rate during continuous transmission is as follows. transfer rate = 11 fl + 2/(f x /4)
chapter 10 serial interface function 522 preliminary user ? s manual u16031ej2v1ud 10.2.8 control flow (1) example of continuous transmission processing flow in single mode (cpu control) figure 10-11. example of continuous transmission processing flow in single mode (cpu control) set uartb-related registers yes ubntsf = 0? (ubnstr) no start ubntxe = 1 (ubnctl0) : enable transmission write ubntx register : write transmit data ubntxe = 0 (ubnctl0) : disable transmission yes ubtitn interrupt = 1? : ubntx register can be written? no yes end of transmission? : all transmit data written? : transmission completed? no end remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 523 (2) example of continuous reception processing flow in single mode (cpu control) figure 10-12. example of continuous reception processing flow in single mode (cpu control) set uartb-related registers start ubnrxe = 1 (ubnctl0) : enable reception error processing in single mode yes ubtiren interrupt = 1? : reception error occurred? yes ubtirn interrupt = 1? : 1-byte reception completed? no yes reception completed? : reception completed? no no end read ubnrx register : read receive data ubnrxe= 0 (ubnctl0) : disable reception remark n = 0, 1
chapter 10 serial interface function 524 preliminary user ? s manual u16031ej2v1ud (3) example of continuous transmission processing flow in single mode (dma control) figure 10-13. example of continuous transmission processing flow in single mode (dma control) set uartb/dmac-related registers note start dtfrm register = 3ch : assign dma transfer destination (in the case of ubtit0) yes dma completed? : dma transfer completed? no yes ubntsf = 0? (ubnstr) : transmission completed? no ubntxe = 0 (ubnctl0) : disable transmission end dtfrm register = 3ch : clear dfm bit emm = 1 (dchcm) : enable dma transfer ubntxe = 1 (ubnctl0) : enable transmission write ubntx register : write transmit data note in this control flow example, transmission of the first byte of the data is executed by a cpu write operation. exercise care in setting the number of data for dma transfer (dbcm register) and the source address (dsamh and dsaml registers). remark n = 0, 1 m = 0 to 3
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 525 (4) example of continuous reception processing flow in single mode (dma control) figure 10-14. example of continuous reception processing flow in single mode (dma control) set uartb/dmac-related registers start dtfrm register = 3bh : assign dma transfer destination (in the case of ubtir0) yes dma completed? : dma transfer (reception) completed? no ubnrxe = 0 (ubnctl0) : disable reception end dtfrm register = 3bh : clear dfm bit emm = 1 (dchcm) : enable dma transfer ubnrxe = 1 (ubnctl0) : enable reception remark n = 0, 1 m = 0 to 3
chapter 10 serial interface function 526 preliminary user?s manual u16031ej2v1ud (5) example of continuous transmission processing flow in fifo mode (cpu control) figure 10-15. example of continuous transmission processing flow in fifo mode (cpu control) set uartb-related registers start write transmit fifon note 1 : write transmit data yes ubtifn interrupt = 1? : transmission completed? note 2 yes ubtitn interrupt = 1? : writing to transmit fifon enabled? no yes transmission completed? : writing all transmit data completed? no : transmission completed? no end ubntxe = 0 (ubnctl0) write transmit fifon note 3 : disable transmission clear transmit fifon ubntxe = 1 (ubnctl0) : enable transmission yes ubtifn interrupt = 1? no notes 1. write more transmit data than the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register to transmit fifon. 2. this is the case where transmission is completed (transmit fifon and transmit shift register n become empty) before the next transmit data is written. to continue data transmission, clear the ubtifn and ubtitn interrupts and write the next data to transmit fifon. 3. in the pending mode (ubnitm bit of the ubnfic0 register = 0), write as many transmit data as the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register to transmit fifon. in the pointer mode (ubnitm bit = 1), reference the ubntb4 to ubntb0 bits of the ubnfis1 register and write as many data as the number of vacant bytes in transmit fifon to transmit fifon. to fully use the 8-bit 16-stage fifo function, write 16-byte data. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 527 (6) example of continuous reception processing in fifo mode (cpu control) figure 10-16. example of continuous reception processing in fifo mode (cpu control) set uartb-related registers start ubnrxe = 1 (ubnctl0) : enable reception yes ubtiton interrupt = 1? : reception timeout occurred? yes ubtirn interrupt = 1? : reading from receive fifon enabled? no yes reception completed? : reading all receive data completed? no no no ubtiren interrupt = 1? : reception error occurred? yes end read receive fifon note 1 : read receive data error processing in fifo mode ubnrxe= 0 (ubnctl0) : disable reception check ubnfis0 register read receive fifon note 2 : read receive data remaining in receive fifon clear receive fifon notes 1. read as many receive data as the number set as the trigger by the ubnrt3 to ubnrt0 bits of the ubnfic2 register from receive fifon in the pending mode (ubnitm bit of the ubnfic0 register = 0). in the pointer mode (ubnitm bit = 1), reference the ubnrb4 to ubnrb0 bits of the ubnfis0 register and read as many data as the number of bytes stored in receive fifon from receive fifon. 2. read as many data (remaining receive data less than the number set as the trigger) as the number of bytes stored in receive fifon from receive fifon by referencing the ubnrb4 to ubnrb0 bits of the ubnfis0 register. remark n = 0, 1
chapter 10 serial interface function 528 preliminary user ? s manual u16031ej2v1ud (7) example of continuous transmission (pending mode) processing in fifo mode (dma control) figure 10-17. example of continuous transmission (pending mode) processing in fifo mode (dma control) set uartb/dmac-related registers note 1 start dtfrm register = 3ch : assign dma transfer destination (in the case of ubtit0) yes dma completed? : dma transfer completed? no yes ubtifn interrupt = 1? : transmission completed? no ubntxe = 0 (ubnctl0) : disable transmission end dtfrm register = 3ch : clear dfm bit emm = 1 (dchcm) : enable dma transfer ubntxe = 1 (ubnctl0) : enable transmission clear transmit fifon write transmit fifon note 2 : write transmit data notes 1. in this control flow example, transmission of the data described in note 2 is executed by a cpu write operation. exercise care in setting the number of data for dma transfer (dbcm register) and the source address (dsamh and dsaml registers). 2. write as many transmit data as the number set as the trigger by the ubntt3 to ubntt0 bits of the ubnfic2 register (= 1 byte) to transmit fifon. remark n = 0, 1, m = 0 to 3
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 529 (8) example of continuous reception (pending mode) processing flow in fifo mode (dma control) figure 10-18. example of continuous reception (pending mode) processing flow in fifo mode (dma control) set uartb/dmac-related registers start dtfrm register = 3bh : assign dma transfer destination (in the case of ubtir0) yes dma completed? : dma transfer (reception) completed? no ubnrxe = 0 (ubnctl0) : disable reception end dtfrm register = 3bh : clear dfm bit emm = 1 (dchcm) : enable dma transfer ubnrxe = 1 (ubnctl0) : enable reception clear receive fifon remark n = 0, 1 m = 0 to 3
chapter 10 serial interface function 530 preliminary user ? s manual u16031ej2v1ud (9) example of reception error processing in single mode figure 10-19. example of reception error processing in single mode start read ubnrx register : extract receive data (error data) end clear error flag read ubnstr register : check error flag caution reception can be continued by completing this control flow before reception of the next data is completed. if the next data is received before this control flow is completed, a reception error interrupt (ubtiren) may occur even if the data has been received correctly. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 531 (10) example of reception error processing flow in fifo mode (1) figure 10-20. example of reception error processing flow in fifo mode (1) start ubnrxe = 0 (ubnctl0) note : stop reception end read ubnfis0 register : check receive fifon pointer read ubnrxap register : extract receive data and check error ubnrfc = 1 (ubnfic0) : clear receive fifon clear error flag read ubnstr register : check error flag note if the error flag is cleared when ubnrxe bit = 0, the ubnctl0 register does not have to be set. remark n = 0, 1
chapter 10 serial interface function 532 preliminary user?s manual u16031ej2v1ud (11) example of reception error processing flow in fifo mode (2) figure 10-21. example of reception error processing flow in fifo mode (2) start end read ubnfis0 register : check receive fifon pointer read ubnrxap register : extract receive data and check error clear error flag read ubnstr register : check error flag note reception can be continued by completing this control flow before reception of the next data is completed. extract the receive data and check if a reception error has occurred before receive fifon becomes empty. note that this control flow is valid only when a parity error or a framing error occurs. if an overflow error occurs, receive fifon must be cleared (ubnrfc bit of the ubnfic0 register = 1). if the next data is received before this control flow is completed, a reception error interrupt (ubtiren) may occur even if the data has been received correctly. remark n = 0, 1 10.2.9 cautions when the supply of clocks to uartbn is stopped (for example, idle or stop mode), operation stops with each register retaining the value it had immediately before the supply of clocks was stopped. the txdn pin output also holds and outputs the value it had immediately before the supply of clocks was stopped. however, operation is not guaranteed after the supply of clocks is restarted. therefore, after the supply of clocks is restarted, the circuits should be initialized by setting ubnpwr = 0, ubnrxe = 0, and ubntxe = 0.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 533 10.3 clocked serial interfaces 30, 31 (csi30, csi31) 10.3.1 features ? transfer rate: master mode/slave mode: maximum 5.5 mbps ? half-duplex communications ? master mode and slave mode can be selected ? transmission data length: 8 to 16 bits (selectable in 1-bit units) ? transfer data direction can be switched between msb first and lsb first ? 3-wire mode son: serial data output sin: serial data input sckn: serial clock i/o ? bit rate in master mode: brg output (selected by the cks3n2 to cks3n0 bits and mdln2 to mdln0 bits of clocked serial interface clock select register n (csic3n)) in slave mode: clock input from master (when cks3n2 to cks3n0 bits = 111 in the csic3n register) ? interrupt sources: 2 types ? transmission/reception completion interrupt (intcsi3n) ? csibufn overflow interrupt (intcovf3n) ? transmission mode, reception mode, or transmission/reception mode can be selected ? transmission mode: transmission is started by writing transmit data to transmit data csi buffer register 3n (sfdb3n) while transmission is enabled (refer to 10.3.5 (11) transmission mode ). ? reception mode: reception is started by using processing that writes dummy data to transmit data csi buffer register 3n (sfdb3n) as a trigger while reception is enabled (refer to 10.3.5 (12) reception mode ). ? transmission/reception mode: transmission/reception is started by using processing that writes transmit data to transmit data csi buffer register 3n (sfdb3n) while transmission/reception is enabled (refer to 10.3.5 (13) transmission/reception mode ). ? sixteen on-chip 16-bit transmit/receive buffers (csibufn) ? on-chip dedicated baud rate generator remark n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 534 10.3.2 configuration csi3n is controlled by the clocked serial interface mode register 3n (csim3n) (n = 0, 1). (1) clocked serial interface mode registers 30, 31 (csim30, csim31) the csim3n register is an 8-bit register for specifying the operation of csi3n. (2) clocked serial interface clock select registers 30, 31 (csic30, csic31) the csic3n register is an 8-bit register for controlling the operation clock and operating mode of csi3n. (3) serial i/o shift registers 0, 1 (sio0, sio1) the sion register is an 8-bit register for converting between serial data and parallel data. sion is used for both transmission and reception. data is shifted in (reception) or shifted out (transmission) beginning at either the msb side or the lsb side. (4) receive data buffer registers 30, 31 (sirb30, sirb31) the sirb3n register is a 16-bit buffer register that stores receive data. this register is also divided into two registers: the higher 8 bits (sirb3nh) and lower 8 bits (sirb3nl). (5) transmit data csi buffer registers 30, 31 (sfdb30, sfdb31) the sfdb3n register is a 16-bit buffer register that stores transmit data. this register is also divided into two registers: the higher 8 bits (sfdb3nh) and lower 8 bits (sfdb3nl). (6) csibuf status registers 30, 31 (sfa30, sfa31) the sfa3n register is an 8-bit register that indicates the status of csi data buffer register n (csibufn) or the transfer status. (7) transfer data length select registers 30, 31 (csil30, csil31) the csil3n register is an 8-bit register that selects the csi3n transfer data length. (8) transfer data number specification registers 30, 31 (sfn30, sfn31) the sfn3n register is an 8-bit register that sets the number of csi3n transfer data in continuous mode. (9) csi data buffer registers 0, 1 (csibuf0, csibuf1) by consecutively writing transmit data to the sfdb3n register from where it is transferred, the data can be stored in the csibufn register while the csibufn pointer for writing is automatically incremented (csibufn). the csibufn is a 16-bit buffer register. in the continuous mode, the data received in the csibufn register can be sequentially read while the read csibufn pointer is automatically incremented, by continuously reading the receive data from the sirb3n register.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 535 figure 10-22. block diagram of clocked serial interfaces 30 and 31 son sckn intcsi3n sin sckn transfer control csi data buffer register n (csibufn) brgn prescaler output f x /4 receive data buffer register 3n (sirb3n) 15 0 intcovf3n transfer data control csibuf status register 3n (sfa3n) transmit data csi buffer register 3n (sfdb3n) selector note 1 note 2 f xclk clocked serial interface clock select register 3n (csic3n) mdln1 mdln0 cks3n2 cks3n1 cks3n0 mdln2 internal bus internal bus shift register n (sion) notes 1. in single mode 2. in continuous mode remarks 1. n = 0, 1 2. f x : main clock f xclk : base clock selected by cks3n2 to cks3n0 bits of csic3n register
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 536 10.3.3 control registers because csi30 shares pins with uartb0, the csi30 mode must be set in advance by using the pmc1 and pfc1 registers (see 10.1.1 switching between uartb0 and csi30 modes ). (1) clocked serial interface mode registers 30, 31 (csim30, csim31) the csim3n register controls the operation of csi3n (n = 0, 1). these registers can be read or written in 8-bit or 1-bit units. be sure to clear bit 0 to 0. if it is set to 1, the operation is not guaranteed. cautions 1. writing the trmdn, dirn, csitn, and cswen bits is enabled only when ctxen bit = 0 and crxen bit = 0. 2 to use csi3n, be sure to set the external pins related to the csi3n function to control the mode. then set the csicaen bit to 1 before setting the other bits. (1/2) csicae0 csicae1 csim30 csim31 ctxe0 ctxe1 5 crxe0 crxe1 trmd0 trmd1 3 dir0 dir1 2 csit0 csit1 1 cswe0 cswe1 0 0 address fffffd00h fffffd20h after reset 00h 00h 0 4 6 7 bit position bit name function 7 csicaen controls the operating clock. 0: stop clock supply to csi3n. 1: supply clock to csi3n. cautions 1. the csi3n unit is reset when the csicaen bit = 0, and csi3n is stopped. to operate csi3n, first set the csicaen bit to 1. 2. when rewriting the csicaen bit from 0 to 1 or from 1 to 0, simultaneously rewriting the bits other than the csicaen bit of the csim3n register is prohibited. when the csicaen bit = 0, rewriting the bits other than the csicaen bit of the csim3n register, and the sfdb3n, sfdb3nl, and sfa3n registers is prohibited. 6 ctxen enables or disables transmission. 1: disables transmission. 0: enables transmission. caution the ctxen bit is reset when the csicaen bit is cleared to 0. remark n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 537 (2/2) bit position bit name function 5 crxen enables or disables reception. 1: disables reception. 0: enables reception. caution the crxen bit is reset when the csicaen bit is cleared to 0. 4 trmdn specifies the transfer mode. 0: single mode 1: continuous mode 3dirn specifies the transfer direction when data is written from the sfdb3n register to the csibufn register or read from the sirb3n and csibufn registers. 0: the first bit of transfer data is the msb. 1: the first bit of transfer data is the lsb. 2 csitn controls delay of the transmission completion interrupt signal (intcsi3n) (see 10.3.5 (14) delay control of transmission/reception completion interrupt (intcsi3n) ) . 0: no delay 1: delay mode (in the continuous mode (trmdn = 1), the next data transfer is delayed half a cycle because the interrupt request signal is delayed half a cycle.) cautions 1. the delay mode (csit bit = 1) is valid only in the master mode (when the cks3n2 to cks3n0 bits of the csic3n register are other than 111). in the slave mode (when the cks3n2 to cks3n0 bits are 111), do not set the delay mode. even if the delay mode is set, intcsi3n is not affected by the csitn bit. 2. if the csitn bit is set to 1 in the continuous mode (trmdn bit = 1), the intcsi3n interrupt is not output except when the last data set by the sfnn3 to sfnn0 bits of the sfn3n register is transferred, but a delay of half a clock can be inserted between each data transfer. 1 cswen enables or disables transfer wait. 0: disables transfer wait (1 wait cycle not inserted on starting transfer). 1: enables transfer wait (1 wait cycle inserted on starting transfer). caution inserting a transfer wait cycle (cswen bit = 1) is valid only in the master mode (cks3n2 to cks3n0 bits = other than 111 in the csic3n register). in the slave mode (cks3n2 to cks3n0 bits = 111), do not insert a transfer wait cycle. even if set, a transfer wait cycle is not inserted. remark n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 538 (2) clocked serial interface clock select registers 30, 31 (csic30, csic31) the csic3n register is an 8-bit register that controls the operation clock and operating mode of csi3n. these registers can be read or written in 8-bit or 1-bit units. caution data can be written to the csic3n register only when the ctxen bit = 0 and crxen bit = 0 in the csim3n register. (1/3) mdl02 mdl12 csic30 csic31 mdl01 mdl11 5 mdl00 mdl10 ckp0 ckp1 3 dap0 dap1 2 cks302 cks312 1 cks301 cks311 cks300 cks310 address fffffd01h fffffd21h after reset 07h 07h 0 4 6 7 bit position bit name function specify the transfer clock (brgn output signal). mdln2 mdln1 mdln0 set value (n) transfer clock (brgn output signal) 000 ? brgn stop mode (power save) 001 1f xclk /2 010 2f xclk /4 011 3f xclk /6 100 4f xclk /8 101 5f xclk /10 110 6f xclk /12 111 7f xclk /14 7 to 5 mdln2 to mdln0 caution in the slave mode (cks3n2 to cks3n0 bits = 111), it is recommended to clear the mdln2 to mdln0 bits to 000 (brgn stop mode). remark f xclk : base clock selected by cks3n2 to cks3n0 bits remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 539 (2/3) bit position bit name function specify the data transmission/reception timing for sckn. ckpn dapn operation mode 00 d7 d6 d5 d4 d3 d2 d1 d0 sckn (i/o) sin capture son (output) 01 d7 d6 d5 d4 d3 d2 d1 d0 sckn (i/o) sin capture son (output) 1 note 0 d7 d6 d5 d4 d3 d2 d1 d0 sckn (i/o) sin capture son (output) 1 note 1 d7 d6 d5 d4 d3 d2 d1 d0 sckn (i/o) sin capture son (output) 4, 3 ckpn, dapn note if the ckpn bit is set to 1 in the master mode (cks3n2 to cks3n0 bits are other than 111), the sckn pin outputs a low level when it is inactive. if the ctxen bit of the csim3n register is cleared to 0 (disabling transmission) and crxen bit is cleared to 0 (disabling reception), the sckn pin outputs a high level. therefore, take the following measures to fix the sckn pin to low level when csi3n is not used. [sck0 pin (sck1 pin)] <1> clearing the p11 bit of the p1 register to 0 (clearing the p23 bit of the p2 register to 0): the port output level is set to low. <2> clearing the pm11 bit of the pm1 register to 0 (clearing the pm23 bit of the pm2 register to 0): the port is set in the output mode. <3> clearing the pmc11 bit of the pmc1 register to 0 (clearing the pmc23 bit of the pmc2 register to 0): the pin is set in the port mode (fixed to low-level output). <4> clearing the ctxe0 and crxe0 bits of the csim30 register to 0 (clearing the ctxe1 and crxe1 bits of the csim31 register to 0): transmission and reception are disabled. <5> setting the ctxe0 or crxe0 bit of the csim30 register to 1 (setting the ctxe1 or crxe1 bit of the csim31 register to 1): transmission or reception is enabled (both transmission and reception can also be enabled). <6> setting the pmc11 bit of the pmc1 register to 1 (setting the pmc23 bit of the pmc2 register to 1): the pin is set in the control mode (sck0 and sck1 pin output). because the register set values <1> and <2> are retained, control can be performed only by <3> to <6> once they have been set. remark n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 540 (3/3) bit position bit name function specify the base clock (prescaler output). cks3n2 cks3n1 cks3n0 set value (k) base clock (f xclk ) mode 000 0f x /4 master mode 001 1f x /8 master mode 010 2f x /16 master mode 011 3f x /32 master mode 100 4f x /64 master mode 101 5f x /128 master mode 110 6f x /256 master mode 1 1 1 7 external clock (sckn) slave mode 2 to 0 cks3n2 to csk3n0 remark f x : main clock remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 541 (3) receive data buffer registers 30, 31 (sirb30, sirb31) the sirb3n register is a 16-bit buffer register that stores receive data. by consecutively reading this register in the continuous mode (trmdn bit = 1 in the csim3n register), the received data in the csibufn register can be sequentially read while the csibufn pointer for reading is incremented. in the single mode (trmdn bit = 0 in the csim3n register), received data is read by reading the sirb3n register and it is judged that the sirb3n register has become empty. the sirb3n register is read-only, in 16-bit units. when the higher 8 bits of the sirb3n register are used as the sirb3nh register and the lower 8 bits as the sirb3nl register, these registers are read-only, in 8-bit units. when reading in 8-bit units, be sure to read the sirb3nh register and sirb3nl register in that order. 14 sirb 014 13 sirb 013 12 sirb 012 2 sirb 02 3 sirb 03 4 sirb 04 5 sirb 05 6 sirb 06 7 sirb 07 8 sirb 08 9 sirb 09 10 sirb 010 11 sirb 011 15 sirb 015 1 sirb 01 0 sirb 00 sirb30 address fffffd02h after reset note 0000h sirb 114 sirb 113 sirb 112 sirb 12 sirb 13 sirb 14 sirb 15 sirb 16 sirb 17 sirb 18 sirb 19 sirb 110 sirb 111 sirb 115 sirb 11 sirb 10 sirb31 fffffd22h 0000h note in continuous mode (trmdn bit = 1 in the csim3n register): undefined bit position bit name function 15 to 0 sirbn15 to sirbn0 store receive data. remarks 1. n = 0, 1 2. the sirb3n register is cleared to 0000h when the csicaen bit of the csim3n register is cleared to 0.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 542 (4) transmit data csi buffer registers 30, 31 (sfdb30, sfdb31) the sfdb3n register is a 16-bit buffer register that stores transmit data. when transmit data is written to this register, the data is sequentially stored in the csibufn register while the csibufn pointer for writing is incremented. when the data of this register is read, the value of the transmit data written last is read. the sfdb3n register can be read or written in 16-bit units. when the higher 8 bits of the sfdb3n register are used as the sfdb3nh register, and the lower 8 bits as the sfdb3nl register, these registers can be read or written in 8-bit units. when reading in 8-bit units, be sure to read the sfdb3nh register and sfdb3nl register in that order. 14 sfdb 014 13 sfdb 013 12 sfdb 012 2 sfdb 02 3 sfdb 03 4 sfdb 04 5 sfdb 05 6 sfdb 06 7 sfdb 07 8 sfdb 08 9 sfdb 09 10 sfdb 010 11 sfdb 011 15 sfdb 015 1 sfdb 01 0 sfdb 00 sfdb30 address fffffd06h after reset 0000h sfdb 114 sfdb 113 sfdb 112 sfdb 12 sfdb 13 sfdb 14 sfdb 15 sfdb 16 sfdb 17 sfdb 18 sfdb 19 sfdb 110 sfdb 111 sfdb 115 sfdb 11 sfdb 10 sfdb31 fffffd26h 0000h bit position bit name function 15 to 0 sfdbn15 to sfdbn0 store transmit data. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 543 (5) csibuf status registers 30, 31 (sfa30, sfa31) these registers indicate the status of the csibufn register or the transfer status. these registers can be read or written in 8-bit or 1-bit units (however, bits 6 to 0 can only be read. they do not change even if they are written). cautions 1. reading the sfa3n register is prohibited when the csicaen bit of the csim3n register is 1 and when the main clock (f x ) is stopped. 2. because the values of the sffuln, sfempn, csotn, and sfpn3 to sfpn0 bits may change at any time during transfer, their values during transfer may differ from the actual values. especially, use the csotn bit independently (do not use this bit in relation with the other bits). to detect the end of transfer by the sfa3n register, check to see if the sfempn bit is 1 after the data to be transferred has been written to the csibufn register. 3. if the sfa3n register is read immediately after data has been written to the sfdb3n and sfdb3nl registers when the main clock (f x ) is 84 mhz or lower, the values of the sffuln, sfempn, and sfpn3 to sfpn0 bits do not change in time. 4. if the sfa3n register is read before the sffuln bit is set to 1 and the 17th data is written, the csibufn overflow interrupt (intcovf3n) is generated. (1/3) fpclr0 fpclr1 sfa30 sfa31 sfful0 sfful1 5 sfemp0 sfemp1 csot0 csot1 3 sfp03 sfp13 2 sfp02 sfp12 1 sfp01 sfp11 sfp00 sfp10 address fffffd08h fffffd28h after reset 20h 20h 0 4 6 7 bit position bit name function 7 fpclrn specifies clearing of the csibufn pointer. 0: no operation 1: clear all csibufn pointers to 0. cautions 1. this bit is always 0 when it is read. 2. if 1 is written to the fpclrn bit in the middle of transfer, transfer is aborted. because all the csibufn pointers are cleared to 0, the remaining data in the csibufn register is ignored. if 1 is written to the fpclrn bit, be sure to read the sfa3n register to check to see if all the csibufn pointers have been correctly cleared to 0 (sffuln bit = 0, sfempn bit = 1, sfpn3 to sfpn0 bits = 0000). nothing happens even if 0 is written to the fpclrn bit. remarks 1. n = 0, 1 2. the sfa3n register is set to 20h when the csicaen bit of the csim3n register is cleared to 0.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 544 (2/3) bit position bit name function 6 sffuln this flag indicates the full status of the csibufn register. 0: csibufn register has a vacancy. 1: csibufn register is full. cautions 1. this bit is cleared to 0 when the csicaen bit of the csim3n register is cleared to 0 and the fpclr bit is set to 1. 2. if transfer of 16 data is specified in the continuous mode (trmdn bit = 1 in the csim3n register) (sfnn3 to sfnn0 bits = 0000 in the sfn3n register), the sffuln bit is set to 1 in the same way as in the single mode (trmdn bit = 0 in the csim3n register) when 16 data are in the csibufn register. if even one of the data has been completely transferred, the sffuln bit is cleared to 0. however, this does not mean that the csibufn register has a vacancy. 5 sfempn this flag indicates the empty status of the csibufn register. 0: data is in csibufn register. 1: csibufn register is empty. cautions 1. this flag is set to 1 when the csicaen bit of the csim3n register is cleared to 0 and the fpclr bit is set to 1. 2. if the data written to the csibufn register has been transferred, the sfempn bit is set to 1 (even if receive data is stored in the csibufn register). 4csotn this flag indicates transfer status. 0: idle status 1: transfer or transfer start processing in progress cautions 1. this flag is cleared to 0 when the csicaen bit of the csim3n register is cleared to 0 and the fpclrn bit is set to 1, or when the ctxen and crxen bits of the csim3n register are cleared to 0. 2. this flag is ?1? from when transfer is started until there is no more transfer data in the csibufn register in the single mode (trmdn bit = 0 in the csim3n register) or until the specified number of data has been transferred in the continuous mode (trmdn bit = 1 in the csim3n register). remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 545 (3/3) bit position bit name function 3 to 0 sfpn3 to sfpn0 ? in the single mode (trmdn bit = 0 in the csim3n register), the ? number of transfer data remaining in csibufn register (csibufn pointer value for writing ? csibufn pointer value for sion loading) ? can be read. ? in the continuous mode (trmdn bit = 1 in the csim3n register), the ? number of data completely transferred (value of csibufn pointer for sion loading/storing) ? can be read. if the sfpn3 to sfpn0 bits are 0h, however, the number of transferred data is as follows, depending on the setting of the sfempn bit. when sfempn bit = 0: number of transferred data = 0 when sfempn bit = 1: number of transferred data = 16 or status before starting transfer (before writing transfer data) caution these bits are cleared to 0 in synchronization with the operating clock when the fpclrn bit = 1. however, the values of these bits are held until the csicaen bit of the csim3n register is cleared to 0 or the fpclrn bit is set to 1. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 546 (6) transfer data length select registers 30, 31 (csil30, csil31) the csil3n register is used to select the transfer data length of csi3n. these registers can be read or written in 8-bit or 1-bit units. be sure to clear bits 7 to 4 to 0. if they are set to 1, the operation is not guaranteed. caution the csil3n register may be transferring data when the ctxen or crxen bit of the csim3n register is 1. before writing data to the csil3n register, be sure to clear the ctxen and crxen bits to 0. 0 0 csil30 csil31 0 0 5 0 0 0 0 3 ccl03 ccl13 2 ccl02 ccl12 1 ccl01 ccl11 ccl00 ccl10 address fffffd09h fffffd29h after reset 00h 00h 0 4 6 7 bit position bit name function specifies a transfer data length. ccln3 ccln2 ccln1 ccln0 transfer data length 0 0 0 0 16 bits 10008 bits 10019 bits 1 0 1 0 10 bits 1 0 1 1 11 bits 1 1 0 0 12 bits 1 1 0 1 13 bits 1 1 1 0 14 bits 1 1 1 1 15 bits other than above setting prohibited 3 to 0 ccln3 to ccln0 caution if a transfer data length other than 16 bits is specified (ccln3 to ccln0 bits = 0000), an undefined value is read to the higher excess bits of the sirb3n and csibufn registers (see 10.3.5 (3) data transfer direction specification function). remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 547 (7) transfer data number specification registers 30, 31 (sfn30, sfn31) the sfn3n register is used to set the number of transfer data of csi3n in the continuous mode (trmdn bit = 1 in the csim3n register). these registers can be read or written in 8-bit or 1-bit units. ? ? sfn30 sfn31 ? ? 5 ? ? ? ? 3 sfn03 sfn13 2 sfn02 sfn12 1 sfn01 sfn11 sfn00 sfn10 address fffffd0ch fffffd2ch after reset 00h 00h 0 4 6 7 bit position bit name function specify the number of transfer data. sfnn3 sfnn2 sfnn1 sfnn0 number of transfer data 000016 00011 00102 00113 01004 01015 01106 01117 10008 10019 101010 101111 110012 110113 111014 111115 3 to 0 sfnn3 to sfnn0 caution writing data exceeding the value set by the sfnn3 to sfnn0 bits (number of csi3n transfer data) to the csibufn register is prohibited (data is ignored even if written). remark n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 548 10.3.4 dedicated baud rate generators 0, 1 (brg0, brg1) the transfer clock of csi3n can be selected from the output of a dedicated baud rate generator or external clock (n = 0, 1). the serial clock source is specified by the csic3n register. in the master mode (cks3n2 to cks3n0 bits = other than 111 in the csic3n register), brgn is selected as the clock source. (1) transfer clock figure 10-23. transfer clock of csi3n clocked serial interface clock select register 3n (csic3n) selector prescaler (1/1, 1/2, 1/4, 1/8, 1/16, 1/32, 1/64) brgn (1/2, 1/4, 1/6, 1/8, 1/10, 1/12, 1/14) transfer clock f x /4 sckn mdln1 mdln0 cks3n2 cks3n1 cks3n0 mdln2 f xclk remarks 1. n = 0, 1 2. f x : main clock f xclk : base clock selected by cks3n2 to cks3n0 bits of csic3n register
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 549 (2) baud rate the baud rate is calculated by the following expression. [bps] 2 n f rate baud 1) (k + = f = f x /4 (f x : main clock) k = value set by cks3n2 to cks3n0 bits of csic3n register (k = 0, 1, 2, ? , 6) n = value set by mdln2 to mdln0 bits of csic3n register (n = 1, 2, 3, ? , 7) cautions 1. if the cks3n2 to cks3n0 bits of the csic3n register are cleared to 000, setting the mdln2 to mdln0 bits of the csic3n register to 001 is prohibited. 2. because the maximum transfer rate in the master mode (cks3n2 to cks3n0 bits = other than 111 in the csic3n register) is 5.5 mbps, do not exceed this value. example: when csi3n operates at 133 mhz, the maximum transfer rate is set when the cks3n2 to cks3n0 bits = 000 and the mdln2 to mdln0 bits = 011, and at 150 mhz, when the cks3n2 to cks3n0 bits = 000 and mdln2 to mdln0 bits = 100, in the csic3n register.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 550 10.3.5 operation (1) operation modes table 10-6. operation modes trmdn bit cks3n2 to cks3n0 bits ctxen and crxen bits dirn bit csitn bit cswen bit disables transfer wait master mode enables/disables intcsi3n delay mode enables transfer wait single mode slave mode ?? disables transfer wait master mode enables/disables intcsi3n delay mode enables transfer wait consecutive mode slave mode transmission/reception/ transmission and reception msb/lsb first ?? remarks 1. ctxen bit: bit 6 of csim3n register crxen bit: bit 5 of csim3n register trmdn bit: bit 4 of csim3n register dirn bit: bit 3 of csim3n register csitn bit: bit 2 of csim3n register cswen bit: bit 1 of csim3n register cks3n2 to cks3n0 bits: bits 2 to 0 of csic3n register 2. n = 0, 1 (2) function of csi data buffer registers 0, 1 (csibuf0, csibuf1) by consecutively writing the transmit data to the sfdb3n register from where it is transferred, the data can be stored in the csibufn register while the csibufn pointer for writing is automatically incremented (the csibufn register size is 16 bits 16) (n = 0, 1). the condition under which transfer is to be started (sfempn bit = 0 in the sfa3n register) is satisfied when data is written to the lower 8 bits (sfdb3nl register) of the sfdb3n register. if a transfer data length of 9 bits or more is specified (ccln3 to ccln0 bits = 0000 or 1001 to 1111 in the csil3n register), data must be written to the sfdb3n register in 16-bit units or to the sfdb3nh and sfdb3nl registers, in that order, in 8-bit units. if the transfer data length is set to 8 bits (ccln3 to ccln0 bits = 1000 in the csil3n register), data must be written to the sfdb3nl register in 8-bit units or to the sfdb3n register in 16-bit units. (if data is written to the sfdb3nl register in 16-bit units, however, the higher 8 bits of the data (of the sfdb3nh register) are ignored and not transferred). the sffuln bit of the sfa3n register is set to 1 when 16 data exist in the csibufn register and outputs a csibufn overflow interrupt (intcovf3n) when the sffuln bit = 1 and when the 17th transfer data is written. sixteen data exist in the csibufn register in the single mode (trmdn bit = 0 in the csim3n register) when ? csibufn pointer value for writing = csibufn pointer value for sion loading, and sffuln bit = 1 in the sfa3n register ? . when the csibufn pointer for sion loading is incremented after completion of transfer, the csibufn register has a vacancy of one data (in the continuous mode (trmdn bit = 1 in the csim3n register), the csibufn register does not have a vacancy even if one data has been transferred).
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 551 figure 10-24. function of csi data buffer register n (csibufn) csi data buffer register n (csibufn) 15 15 0 0 transfer data 0 transfer data 1 transfer data 2 transfer data 3 transfer data 4 transmit data csi buffer register 3n (sfdb3n) sfpn3 to sfpn0 70 3 4 csibuf status register 3n (sfa3n) incremented sion load csibufn pointer incremented write csibufn pointer sfdb3nh sfdb3nl 15 8 7 0 remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 552 (3) data transfer direction specification function the data transfer direction can be changed by using the dirn bit of the csim3n register (n = 0, 1). (a) msb first (dirn bit = 0) figure 10-25. transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: msb first (dirn bit = 0 in csim3n register) (1/2) (i) transfer direction: msb first di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 do0 sckn (i/o) sin (input) son (output) (ii) writing from sfdb3n register to csibufn register sfdb3n csibufn data 00h sion 15 8 7 0 son sin remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 553 figure 10-25. transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: msb first (dirn bit = 0 in csim3n register) (2/2) ( iii) reading from sirb3n register (in single mode (trmdn bit of csim3n register = 0)) sirb3n (read value) undefined value data sion 15 8 7 0 son sin ( iv) reading from sirb3n register (in continuous mode (trmdn bit of csim3n register = 1)) sirb3n (read value) csibufn undefined value data sion 15 8 7 0 son sin remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 554 (b) lsb first (dirn bit = 1) figure 10-26. transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: lsb first (dirn bit = 1 in csim3n register) (1/2) (i) transfer direction: lsb first di0 di1 di2 di3 di4 di5 di6 di7 do0 do1 do2 do3 do4 do5 do6 do7 sckn (i/o) sin (input) son (output) (ii) writing from sfdb3n register to csibufn register sfdb3n csibufn data 00h sion 15 8 7 0 son sin remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 555 figure 10-26. transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: lsb first (dirn bit = 1 in csim3n register) (2/2) (iii) reading from sirb3n register (in single mode (trmdn bit of csim3n register = 0)) sirb3n (read value) 00h data sion 15 8 7 0 son sin (iv) reading from sirb3n register (in continuous mode (trmdn bit of csim3n register = 1)) sirb3n (read value) csibufn 00h data sion 15 8 7 0 son sin remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 556 (4) transfer data length changing function the transfer data length can be set from 8 to 16 bits in 1-bit units, by using the ccln3 to ccln0 bits of the csil3n register (n = 1, 0). figure 10-27. transfer data length: 16 bits (ccln3 to ccln0 bits = 0000 in csil3n register), transfer direction: msb first (dirn bit = 0 in csim3n register) di15 di14 di13 di12 di2 di1 di0 do15 do14 do13 do12 do2 do1 do0 sckn (i/o) sin (input) son (output) remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 557 (5) function to select serial clock and data phase the serial clock and data phase can be changed by using the ckpn and dapn bits of the csic3n register (n = 0, 1). figure 10-28. clock timing (a) when ckpn bit = 0, dapn bit = 0 intcsi3n interrupt sin capture sckn son d7 d6 d5 d4 d3 d2 d1 d0 (b) when ckpn bit = 0, dapn bit = 1 intcsi3n interrupt sin capture sckn son d7 d6 d5 d4 d3 d2 d1 d0 (c) when ckpn bit = 1, dapn bit = 0 intcsi3n interrupt sin capture sckn son d7 d6 d5 d4 d3 d2 d1 d0 (d) when ckpn bit = 1, dapn bit = 1 intcsi3n interrupt sin capture sckn son d7 d6 d5 d4 d3 d2 d1 d0 remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 558 (6) master mode the master mode is set and data is transferred with the transfer clock output to the sckn pin when the cks3n2 to cks3n0 bits of the csic3n register are set to a value other than 111 (sckn pin input is invalid) (n = 0, 1). the default output level of the sckn pin is high when the ckpn bit of the csic3n register is 0, and low when the ckpn bit is 1. figure 10-29. master mode (ckpn and dapn bits = 00 in csic3n register, ccln3 to ccln0 bits = 1000 in csil3n register (transfer data length: 8 bits)) di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 do0 sckn (output) sin (input) son (output) remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 559 (7) slave mode the slave mode is set when the cks3n2 to cks3n0 bits of the csic3n register are set to 111, and data is transferred with the transfer clock input to the sckn pin (in the slave mode, it is recommended to set the mdln2 to mdln0 bits of the csic3n register to 000 and set the brgn stop mode) (n = 0, 1). figure 10-30. slave mode (ckpn and dapn bits = 00 in csic3n register, ccln3 to ccln0 bits = 1000 in csil3n register (transfer data length: 8 bits)) di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 do0 sckn (input) sin (input) son (output) remark n = 0, 1 the conditions under which data can be transferred in the slave mode are listed in the table below. table 10-7. conditions under which data can be transferred in slave mode transfer mode ctxen bit crxen bit csibufn register sirb3n register and sion register transmission mode 1 0 data is in csibufn register (sfempn bit = 0). ? reception mode 0 1 dummy data is in csibufn register (sfempn bit = 0). single mode transmission/ reception mode 1 1 data is in csibufn register (sfempn bit = 0). sirb3n register or sion register is empty. transmission mode 1 0 data is in csibufn register (sfempn bit = 0). ? reception mode 0 1 dummy data is in csibufn register (sfempn bit = 0). ? consecutive mode transmission/ reception mode 1 1 data is in csibufn register (sfempn bit = 0). ? remarks 1. ctxen bit: bit 6 of csim3n register crxen bit: bit 5 of csim3n register sfempn bit: bit 5 of sfa3n register 2. n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 560 (8) transfer clock selection function in the master mode (cks3n2 to cks3n0 bits = other than 111 in the csic3n register), the bit transfer rate can be selected by setting the cks3n2 to cks3n0 and mdln2 to mdln0 bits of the csic3n register (see 10.3.3 (2) clocked serial interface clock select registers 30, 31 (csic30, csic31) ). (9) single mode the single mode is set when the trmdn bit of the csim3n register is 0 (n = 0, 1). in this mode, transfer is started when the ctxen bit or crxen bit is set to 1 and when data is in the csibufn register (sfempn bit = 0 in the sfa3n register). if no data is in the csibufn register (sfempn bit = 1), transfer is kept waiting until transmit data or dummy data is written to the sfdb3n register. when data is transferred to the csibufn register while transmission or reception is enabled (ctxen or crxen bit is 1), the csotn bit of the sfa3n register (transfer status flag) is set to 1. if transfer is not in the wait status, the transfer data indicated by the sion load csibufn pointer is loaded from the csibufn register to the sion register, and transfer processing is started. if the sirb3n register is empty when one data has been transferred in the reception mode or transmission/reception mode, the received data is stored from the sion register to the sirb3n register, the transmission/reception completion interrupt (intcsi3n) is output, and the sion load csibufn pointer is incremented. if transmit data or dummy data is stored in the csibufn register, the next transfer processing is started. however, storing the receive data in the sirb3n register, outputting the intcsi3n interrupt, and incrementing the sion load csibufn pointer are held pending, until the previously received data is read from the sirb3n register and the sirb3n register becomes empty. in the transmission mode, the intcsi3n interrupt is output and the sion load pointer is incremented when transfer processing of one data has been completed (the sirb3n register is always empty because no data is stored from the sion register to the sirb3n register). in all modes (transmission, reception, and transmission/reception modes), if the csibufn register is empty (write csibufn pointer value = sion load csibufn pointer value) when transfer processing of one data has been completed, the csotn bit is cleared to 0. the value of the ?number of remaining data in the csibufn register (write csibufn pointer ? sion load pointer)? can always be read from the sfpn3 to sfpn0 bits of the sfa3n register. caution when writing data to the sfdb3n register, be sure to confirm that the sffuln bit of the sfa3n register is 0. even if data is written to this register when sffuln bit is 1, the csibufn overflow interrupt (intcovf3n) is output, and the written data is ignored.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 561 figure 10-31. single mode sion sirb3n son sin csi data buffer register n (csibufn) 15 15 0 0 transfer data 0 transfer data 1 transfer data 2 transfer data 3 transfer data 4 transmit data csi buffer register 3n (sfdb3n) sfpn3 to sfpn0 70 3 4 csibuf status register 3n (sfa3n) incremented sion load csibufn pointer incremented write csibufn pointer sfdb3nh sfdb3nl 15 8 7 0 difference remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 562 (10)continuous mode the continuous mode is set when the trmdn bit of the csim3n register is 1 (n = 0, 1). in this mode, transfer is started when the ctxen bit or crxen bit is 1 and when data is in the csibufn register (sfempn bit = 0 in the sfa3n register). at this time, set the number of transfer data in advance by using the sfnn3 to sfnn0 bits of the sfn3n register. if 17 or more transfer data are written to the csibufn register, the excess data are ignored and not transferred. do not write data exceeding the number of transfer data specified by the sfnn3 to sfnn0 bits of the sfn3n register to the csibufn register. if no data is in the csibufn register (sfempn bit = 1), transfer is kept waiting until transmit data or dummy data is written to the sfdb3n register. if data is transferred to the csibufn register when transmission or reception is enabled (ctxen or crxen bit is 1), the csotn bit (transfer status flag) of the sfa3n register is set to 1 and the transfer data indicated by the sion load/store csibufn pointer is loaded from the csibufn register to sion register. then transfer processing is started. when transfer processing of one data is completed in the reception mode or transmission/reception mode, the received data is overwritten from the sion register to the transfer data in the csibufn register indicated by the sion load/store csibufn pointer, and then the pointer is incremented. by consecutively reading the transfer data from the sirb3n register after all data in the csibufn register have been transferred (when the intcsi3n interrupt has occurred), the receive data can be sequentially read while the read csibufn pointer is incremented. in the transmission mode, the sion load/store csibufn pointer is incremented when transfer processing of one data has been completed. in all modes (transmission, reception, and transmission/reception modes), when data has been transferred by the value set by the sfnn3 to sfnn0 bits of the sfn3n register, the csotn bit is cleared to 0 and the transmission/reception completion interrupt (intcsi3n) is output. to transfer the next data, be sure to write 1 to the fpclrn bit of the sfa3n register and clear all the csibufn pointers to 0. the ? number of transferred data (sion load/store csibufn pointer value) ? can always be read from the sfpn3 to sfpn0 bits of the sfa3n register. caution the sfa3n register is in the same status when transfer data is written (before start of transfer) after the csibufn pointer is cleared (fpclrn bit = 1 in the sfa3n register) and when 16 data have been transferred (sffuln bit = 0, sfempn bit = 1, sfpn3 to sfpn0 bits = 0000 in the sfa3n register).
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 563 figure 10-32. continuous mode transfer data 0 sirb3n son sin csi data buffer register n (csibufn) 15 15 0 0 transfer data 1 transfer data 2 transfer data 3 transmit data csi buffer register 3n (sfdb3n) sfpn3 to sfpn0 70 3 4 csibuf status register 3n (sfa3n) incremented read csibufn pointer incremented sion load/store csibufn pointer incremented write csibufn pointer sfdb3nh sfdb3nl 15 8 7 0 sion note 1 note 2 note 1 notes 1. reception 2. transmission remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 564 (11)transmission mode the transmission mode is set when the ctxen bit of the csim3n register is set to 1 and the crxen bit is cleared to 0. in this mode, transmission is started by a trigger that writes transmit data to the sfdb3n register or sets the ctxen bit to 1 when transmit data is in the csibufn register (n = 0, 1). even in the single mode (trmdn bit = 0 in the csim3n register), whether the sirb3n or sion register is empty has nothing to do with starting transmission. the value input to the sin pin during transmission is latched in the shift register (sion) but is not transferred to the sirb3n and csibufn registers at the end of transmission. the transmission/reception completion interrupt (intcsi3n) occurs immediately after data is sent out from the sion register. (12)reception mode the reception mode is set when the ctxen bit of the csim3n register is cleared to 0 and crxen bit is set to 1. in this mode, reception is started by using the processing of writing dummy data to the sfdb3n register as a trigger (n = 0, 1). in the single mode (trmdn bit = 0 in the csim3n register), however, the condition of starting reception includes that the sirb3n or sion register is empty. (if reception to the sion register is completed when the previously received data is held in the sirb3n register without being read, the previously received data is read from the sirb3n register and the wait status continues until the sirb3n register becomes empty.) in the continuous mode, reception starts by writing dummy data of the number of receive data to the sfdb3n register with the first dummy data write processing taken as a trigger. the son pin outputs a low level. the transmission/reception completion interrupt (intcsi3n) occurs immediately after receive data is transferred from the sion register to the sirb3n register. (13)transmission/reception mode the transmission/reception mode is set when both the ctxen and crxen bits of the csim3n register are set to 1. in this mode, transmission/reception is started by using the processing to write transmit data to the sfdb3n register as a trigger (n = 0, 1). in the single mode (trmdn bit = 0 in the csim3n register), however, the condition of starting transmission/reception includes that the sirb3n or sion register is empty. (if reception to the sion register is completed when the previously received data is held in the sirb3n register without being read, the previously received data is read from the sirb3n register and the wait status continues until the sirb3n register becomes empty.)
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 565 (14)delay control of transmission/reception completion interrupt (intcsi3n) in the master mode (cks3n2 to cks3n0 bits = other than 111 in the csic3n register), occurrence of the transmission/reception completion interrupt (intcsi3n) can be delayed by half a clock (1/2 serial clock), depending on the setting (1) of the csitn bit of the csim3n register. the csitn bit is valid only in the master mode. in the slave mode (cks3n2 to cks3n0 bits = 111 in the csic3n register), setting the csitn bit to 1 is prohibited (even if set, the intcsi3n interrupt is not affected). caution if the csitn bit of the csim3n register is set to 1 in the continuous mode (trmdn bit = 1 in the csim3n register), the intcsi3n interrupt is not output at the end of data other than the last data set by the sfnn3 to sfnn0 bits of the sfn3n register, but a delay of half a clock can be inserted between each data transfer. figure 10-33. delay control of transmission/reception completion interrupt (intcsi3n): csitn bit = 1 in csic3n register, cswen bit = 0, ckpn and dapn bits = 00, ccln3 to ccln0 bits = 1000 in csil3n register (transfer data length: 8 bits) di7 di7 di6 di5 di4 di3 di2 di1 di0 delay do7 do6 do5 do4 do3 do2 do1 do0 do7 sckn (output) sin (input) son (output) intcsi3n interrupt delay note note if the csitn bit of the csim3n register is set to 1 in the continuous mode (trmdn bit = 1 in the csim3n register), the intcsi3n interrupt is not output at the end of data other than the last data set by the sfnn3 to sfnn0 bits of the sfn3n register, but a delay of half a clock can be inserted between each data transfer. remark n = 0, 1
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 566 (15)enabling/disabling transfer wait in the master mode (cks3n2 to cks3n0 bits = other than 111 in the csic3n register), starting transfer can be delayed by one clock, depending on the setting (1) of the cswen bit of the csim3n register (cswen bit = 1 (transfer wait inserted)). the cswen bit is valid only in the master mode. in the slave mode (cks3n2 to cks3n0 bits = 111 in the csic3n register), setting the cswen bit to 1 is prohibited (even if set, transfer wait is not inserted). figure 10-34. enabling/disabling transfer wait (a) csitn bit = 0, cswen bit = 1, ckpn and dapn bits = 00, ccln3 to ccln0 bits = 1000 (transfer data length: 8 bits) di7 di6 di5 do7 do6 do5 sckn (output) sin (input) son (output) di7 di1 di0 wait do1 do0 do7 (b) csitn bit = 1, cswen bit = 1, ckpn and dapn bits = 00, ccln3 to ccln0 bits = 1000 (transfer data length: 8 bits) di7 di6 di5 do7 do6 do5 sckn (output) sin (input) son (output) intcsi3n interrupt di7 di1 di0 wait delay do1 do0 do7 delay remark n = 0, 1
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 567 (16)output pins (a) sckn pin the sckn pin outputs a high level when both the ctxen and crxen bits of the csim3n register are 0 (n = 0, 1). in the master mode (cks3n2 to cks3n0 bits = other than 111 in the csic3n register), this pin outputs the default level when the fpclrn bit of the sfa3n register is set to 1. table 10-8. default output level of sckn pin ckpn bit cks3n2 to cks3n0 bits default output level of sckn pin 111 (slave mode) high level note 0 other than 111 (master mode) high level 111 (slave mode) ? (input) 1 other than 111 (master mode) low level note default value after reset or value when csicaen bit = 0 in the csim3n register remarks 1. the output of the sckn pin changes if the ckpn bit is rewritten in the master mode. 2. n = 0, 1 (b) son pin the son pin outputs a low level when both the ctxen and crxen bits of the csim3n register are 0 (n = 0, 1). this pin outputs a low level when the fpclrn bit of the sfa3n register is 1 (the previous value is retained only in the slave mode (cks3n2 to cks3n0 bits = 111 in the csic3n register) and when the dapn bit = 0 in the csic3n register). table 10-9. default output level of son pin default output level of son pin low level note note default value after reset or value when csicaen bit = 0 in the csim3n register remark n = 0, 1 (17)csibufn overflow interrupt signal (intcovf3n) the intcovf3n interrupt is output when 16 data exist in the csibufn register and when the 17th data is written (to the sfdb3n or sfdb3nl register) (the 17th data is not written but ignored). in the single mode (trmdn bit = 0 in the csim3n register), 16 data exist in the csibufn register when ?write csibufn pointer value = sion load csibufn pointer value and sffuln bit = 1 in the sfa3n register?. when transfer is completed and the sion load csibufn pointer is incremented, the csibufn register has one vacancy (the csibufn register has no vacancy even when transfer of one data has been completed in the continuous mode (trmdn bit = 1 in the csim3n register)).
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 568 10.3.6 usage (1) single mode (in master mode and transmission mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable transmission by setting the ctxen bit to 1. <7> confirm that the sffuln bit of the sfa3n register is 0, and then write transfer data to the sfdb3n register. if it is clearly known that the sffuln bit is 0 because transfer data is written to that bit by the interrupt servicing routine of intcsi3n, it is not always necessary to confirm that the sffuln bit is 0. <8> confirm that the intcsi3n interrupt has occurred and the sfempn bit of the sfa3n register is 1, and disable transmission by clearing the ctxen bit of the csim3n register to 0 (end of transmission). caution to execute further transfer, repeat <7> before <8>. (2) single mode (in master mode and reception mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable reception by setting the crxen bit to 1. <7> confirm that the sffuln bit of the sfa3n register is 0, and then write dummy transfer data to the sfdb3n register (reception start trigger). if it is clearly known that the sffuln bit is 0 because dummy transfer data is written to that bit by the interrupt servicing routine of intcsi3n, it is not always necessary to confirm that the sffuln bit is 0. <8> confirm that the intcsi3n interrupt has occurred, and then read the sirb3n register. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1, and disable reception by clearing the crxen bit of the csim3n register to 0 (end of reception). cautions 1. to execute further transfer, repeat <7> and <8> before <9>. 2. the son pin outputs a low level but this is invalid.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 569 (3) single mode (in master mode and transmission/reception mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable transmission/reception by setting the ctxen and crxen bits to 1. <7> confirm that the sffuln bit of the sfa3n register is 0, and then write transfer data to the sfdb3n register. if it is clearly known that the sffuln bit is 0 because transfer data is written to that bit by the interrupt servicing routine of intcsi3n, it is not always necessary to confirm that the sffuln bit is 0. <8> confirm that the intcsi3n interrupt has occurred, and then read the sirb3n register. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1, and disable transmission/reception by clearing the ctxen and crxen bits of the csim3n register to 0 (end of transmission/reception). caution to execute further transfer, repeat <7> and <8> before <9>. (4) single mode (in slave mode and transmission mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable transmission by setting the ctxen bit to 1. <7> confirm that the sffuln bit of the sfa3n register is 0, and then write transfer data to the sfdb3n register. if it is clearly known that the sffuln bit is 0 because transfer data is written to that bit by the interrupt servicing routine of intcsi3n, it is not always necessary to confirm that the sffuln bit is 0. <8> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1, and disable transmission by clearing the ctxen bit of the csim3n register to 0 (end of transmission). caution to execute further transfer, repeat <7> before <8>.
chapter 10 serial interface function preliminary user?s manual u16031ej2v1ud 570 (5) single mode (in slave mode and reception mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable reception by setting the crxen bit to 1. <7> confirm that the sffuln bit of the sfa3n register is 0, and then write dummy transfer data to the sfdb3n register (reception start trigger). if it is clearly known that the sffuln bit is 0 because dummy transfer data is written to that bit by the interrupt servicing routine of intcsi3n, it is not always necessary to confirm that the sffuln bit is 0. <8> confirm that the intcsi3n interrupt has occurred, and then read the sirb3n register. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1, and disable reception by clearing the crxen bit of the csim3n register to 0 (end of reception). cautions 1. to execute further transfer, repeat <7> and <8> before <9>. 2. the son pin outputs a low level but this is invalid. (6) single mode (in slave mode and transmission/reception mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable transmission/reception by setting the ctxen and crxen bits to 1. <7> confirm that the sffuln bit of the sfa3n register is 0, and then write transfer data to the sfdb3n register. if it is clearly known that the sffuln bit is 0 because transfer data is written to that bit by the interrupt servicing routine of intcsi3n, it is not always necessary to confirm that the sffuln bit is 0. <8> confirm that the intcsi3n interrupt has occurred, and then read the sirb3n register. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1, and disable transmission/reception by clearing the ctxen and crxen bits of the csim3n register to 0 (end of transmission/reception). caution to execute further transfer, repeat <7> and <8> before <9>.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 571 (7) continuous mode (in master mode and transmission mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable transmission by setting the ctxen bit to 1. <7> set the number of data to be transmitted by using the sfnn3 to sfnn0 bits of the sfn3n register. <8> write transfer data to the sfdb3n register. writing data exceeding the set value of the sfn3n register is prohibited. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1. then write 1 to the fpclrn bit of the sfa3n register, and clear all the csibufn pointers to 0 in preparation for the next transfer. <10> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <11> disable transmission by clearing the ctxen bit of the csim3n register to 0 (end of transmission). caution to execute further transfer, repeat <7> to <10> before <11>. (8) continuous mode (in master mode and reception mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable reception by setting the crxen bit to 1. <7> set the number of data to be received by using the sfnn3 to sfnn0 bits of the sfn3n register. <8> write dummy transfer data of the number of receive data to the sfdb3n register. the first dummy transfer data write is the trigger to start reception. writing dummy data exceeding the set value of the sfn3n register is prohibited. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1. then read the sirb3n register (sequentially read the receive data stored in the csibufn register). <10> write 1 to the fpclrn bit of the sfa3n register, and clear all the csibufn pointers to 0 in preparation for the next transfer. <11> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <12> disable reception by clearing the crxen bit of the csim3n register to 0 (end of reception). cautions 1. to execute further transfer, repeat <7> to <11> before <12>. 2. the son pin outputs a low level.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 572 (9) continuous mode (in master mode and transmission/reception mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable transmission/reception by setting both the ctxen and crxen bits to 1. <7> set the number of data to be transmitted/received by using the sfnn3 to sfnn0 bits of the sfn3n register. <8> write transfer data to the sfdb3n register. writing data exceeding the set value of the sfn3n register is prohibited. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1. then read the sirb3n register (sequentially read the receive data stored in the csibufn register). <10> write 1 to the fpclrn bit of the sfa3n register, and clear all the csibufn pointers to 0 in preparation for the next transfer. <11> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <12> disable transmission/reception by clearing the ctxen and crxen bits of the csim3n register to 0 (end of transmission/reception). caution to execute further transfer, repeat <7> to <11> before <12>. (10)continuous mode (in slave mode and transmission mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable transmission by setting the ctxen bit to 1. <7> set the number of data to be transmitted by using the sfnn3 to sfnn0 bits of the sfn3n register. <8> write transfer data to the sfdb3n register. writing data exceeding the set value of the sfn3n register is prohibited. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1. then write 1 to the fpclrn bit of the sfa3n register, and clear all the csibufn pointers to 0 in preparation for the next transfer. <10> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <11> disable transmission by clearing the ctxen bit of the csim3n register to 0 (end of transmission). caution to execute further transfer, repeat <7> to <10> before <11>.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 573 (11)continuous mode (in slave mode and reception mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable reception by setting the crxen bit to 1. <7> set the number of data to be received by using the sfnn3 to sfnn0 bits of the sfn3n register. <8> write dummy transfer data of the number of receive data to the sfdb3n register. the first dummy transfer data write is the trigger to start reception. writing dummy data exceeding the set value of the sfn3n register is prohibited. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1. then read the sirb3n register (sequentially read the receive data stored in the csibufn register). <10> write 1 to the fpclrn bit of the sfa3n register, and clear all the csibufn pointers to 0 in preparation for the next transfer. <11> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <12> disable reception by clearing the crxen bit of the csim3n register to 0 (end of reception). cautions 1. to execute further transfer, repeat <7> to <11> before <12>. 2. the son pin outputs a low level. (12)continuous mode (in slave mode and transmission/reception mode) <1> set the external pins related to the csi3n function to control mode. <2> when the csicaen bit of the csim3n register is set to 1, supplying the operating clock is enabled. <3> specify the transfer mode by setting the csic3n and csil3n registers. <4> write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0. <5> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <6> specify the transfer mode by using the trmdn, dirn, csitn, and cswen bits of the csim3n register and, at the same time, enable transmission/reception by setting both the ctxen and crxen bits to 1. <7> set the number of data to be transmitted/received by using the sfnn3 to sfnn0 bits of the sfn3n register. <8> write transfer data to the sfdb3n register. writing data exceeding the set value of the sfn3n register is prohibited. <9> confirm that the intcsi3n interrupt has occurred and the sfempn bit is 1. then read the sirb3n register (sequentially read the receive data stored in the csibufn register). <10> write 1 to the fpclrn bit of the sfa3n register, and clear all the csibufn pointers to 0 in preparation for the next transfer. <11> confirm that the sffuln bit = 0, sfempn bit = 1, and sfpn3 to sfpn0 bits = 0000 in the sfa3n register. <12> disable transmission/reception by clearing the ctxen and crxen bits of the csim3n register to 0 (end of transmission/reception). caution to execute further transfer, repeat <7 to <11> before <12>.
chapter 10 serial interface function preliminary user ? s manual u16031ej2v1ud 574 10.3.7 cautions the following points must be noted when using csi3n (n = 0, 1). (1) the csi3n unit is reset and csi3n is stopped when the csicaen bit of the csim3n register is cleared to 0. to operate csi3n, first set the csicaen bit to 1. usually, before clearing the csicaen bit to 0, clear both the ctxen and crxen bits to 0 (after the end of transfer). (2) be sure to write 1 to the fpclrn bit of the sfa3n register to clear all the csibufn pointers to 0 before enabling transfer by setting the ctxen or crxen bit of the csim3n register to 1. if the ctxen or crxen bit is set to 1 without clearing the pointers, and if the previously transferred data remains in the csibufn register, transferring that data is immediately started. if transfer data is set to the csibufn register before transfer is enabled, transfer is started as soon as the ctxen or crxen bit is set to 1. (3) if the sfa3n register is read immediately after data has been written to the sfdb3n and sfdb3nl registers when the main clock (f x ) is used at 84 mhz or lower, the sffuln, sfempn, and sfpn3 to sfpn0 bits of the sfa3n register may not change their values in time. if the sfa3n register is read before the sffuln bit is set to 1 and a 17th data is written, the csibufn overflow interrupt (intcovf3n) occurs.
preliminary user?s manual u16031ej2v1ud 575 chapter 11 usb function controller (usbf) the v850e/me2 has an internal usb function controller (usbf) conforming to the universal serial bus specification. 11.1 overview ? conforms to the universal serial bus specification. ? supports 12 mbps (full-speed) transfer ? endpoint for transfer incorporated endpoint name fifo size (bytes) transfer type remark endpoint0 read 64 control transfer ? endpoint0 write 64 control transfer ? endpoint1 64 2 bulk 1 transfer (in) 2-buffer configuration endpoint2 64 2 bulk 1 transfer (out) 2-buffer configuration endpoint3 64 2 bulk 2 transfer (in) 2-buffer configuration endpoint4 64 2 bulk 2 transfer (out) 2-buffer configuration endpoint7 8 interrupt 1 transfer ? endpoint8 8 interrupt 2 transfer ? ? clock: clock input from uck pin (f usb = 48 mhz) caution when using the usb function, be sure to set (1) the uckcnt bit of the uckc register. if the registers related to the usb function while the uckcnt bit is 0, 0 is read.
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 576 11.2 configuration usb sie i/o buffer endpoint endpoint0r (64 bytes) endpoint0w (64 bytes) endpoint1 (64 bytes 2) endpoint2 (64 bytes 2) endpoint3 (64 bytes 2) endpoint4 (64 bytes 2) endpoint7 (64 bytes) endpoint8 (64 bytes) selector usbsp2b intusb2b intrsum f usb (48 mhz) intusb1b intusb0b usbsp4b ufdrqn dmaakn tcn udm udp usb function 0 dma channel select register (uf0cs) usb function 0 buffer control register (uf0bc) remark n = 0 to 3
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 577 11.3 requests 11.3.1 automatic requests (1) decode the following tables show the request formats and correspondence between requests and decoded values. table 11-1. request format offset field name 0 bmrequesttype 1 brequest 2 lower side 3 wvalue higher side 4 lower side 5 windex higher side 6 lower side 7 wlength higher side
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 578 table 11-2. correspondence between requests and decoded values decoded value response bmrequesttype brequest wvalue windex wlength offset request 0 1 325476 df ad cf data stage get_interface 81h 0ah 00h 00h 00h 0nh 00h 01h stall stall ack nak get_configuration 80h 08h 00h 00h 00h 00h 00h 01h ack nak ack nak ack nak get_descriptor device 80h 06h 01h 00h 00h 00h xxh xxh note 1 ack nak ack nak ack nak get_descriptor configuration 80h 06h 02h 00h 00h 00h xxh xxh note 1 ack nak ack nak ack nak get_status device 80h 00h 00h 00h 00h 00h 00h 02h ack nak ack nak ack nak get_status endpoint 0 82h 00h 00h 00h 00h 00h 80h 00h 02h ack nak ack nak ack nak get_status endpoint x 82h 00h 00h 00h 00h $$h 00h 02h stall stall ack nak clear_feature device note 2 00h 01h 00h 01h 00h 00h 00h 00h ack nak ack nak ack nak clear_feature endpoint 0 note 2 02h 01h 00h 00h 00h 00h 80h 00h 00h ack nak ack nak ack nak clear_feature endpoint x note 2 02h 01h 00h 00h 00h $$h 00h 00h stall stall ack nak set_feature device note 3 00h 03h 00h 01h 00h 00h 00h 00h ack nak ack nak ack nak set_feature endpoint 0 note 3 02h 03h 00h 00h 00h 00h 80h 00h 00h ack nak ack nak ack nak set_feature endpoint x note 3 02h 03h 00h 00h 00h $$h 00h 00h stall stall ack nak set_interface 01h 0bh 00h 0#h 00h 0?h 00h 00h stall stall ack nak set_configuration note 4 00h 09h 00h 00h 01h 00h 00h 00h 00h ack nak ack nak ack nak set_address 00h 05h xxh xxh 00h 00h 00h 00h ack nak ack nak ack nak notes 1. if the wlength value is less than the prepared value, the wlength value is returned; if the wlength value is greater than the prepared value, the prepared value is returned. 2. the clear_feature request clears uf0 device status register l (uf0dstl) and uf0 epn status register l (uf0ensl) (n = 0 to 4, 7, 8) when ack is received in the status stage. remark : data stage is provided : data stage is not provided
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 579 notes 3. the set_feature request sets the uf0 device status register l (uf0dstl) and uf0 epn status register l (uf0ensl) (n = 0 to 4, 7, 8) when ack is received in the status stage. if the e0halt bit of the uf0e0sl register is set, a stall response is made in the status stage or data stage of control transfer for a request other than the get_status endpoint0 request, set_feature endpoint0 request, and a request generated by the cpudec interrupt request, until the clear_feature endpoint0 request is received. a stall response to an unsupported request does not set the e0halt bit of the uf0e0sl register to 1, and the stall response is cleared as soon as the next setup token has been received. 4. if the wvalue is not the default value, an automatic stall response is made. cautions 1. the sequence of control transfer defined by the universal serial bus specification is not satisfied under the following conditions. the operation is not guaranteed under these conditions. ? ? ? ? if an in/out token is suddenly received without a setup stage ? ? ? ? if data pid1 is sent in the data phase of the setup stage ? ? ? ? if a token of 128 addresses or more is received ? ? ? ? if the request data transmitted in the setup stage is of less than 8 bytes 2. an ack response is made even when the host transmits data other than a null packet in the status stage. 3. if the wlength value is 00h during control transfer (read) of fw processing, a null p acket is automatically transmitted for control transfer (without data). the fw request does not automatically transmit a null packet. remarks 1. df: default state, ad: addressed state, cf: configured state 2. n = 0 to 4 it is determined by the setting of the uf0 active interface number register (uf0aifn) whether a request with interface number 1 to 4 is correctly responded to, depending on whether the interface number of the target is valid or not. 3. $$: valid endpoint number including transfer direction the valid endpoint is determined by the currently set alternate setting number (see 11.4 (36) uf0 active alternative setting register (uf0aas) , (38) uf0 endpoint 1 interface mapping register (uf0e1im) to (43) uf0 endpoint 8 interface mapping register (uf0e8im) ). 4. ? and #: value transmitted from host (information on interface numbers 0 to 4) it is determined by the uf0 active interface number register (uf0aifn) and uf0 active alternative setting register (uf0aas) whether an alternate setting request corresponding to each interface number is correctly responded to or not, depending on whether the interface number and alternate setting of the target are valid or not.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 580 (2) processing the processing of an automatic request in the default state, addressed state, and configured state is described below. remark default state: state in which an operation is performed with the default address addressed state: state after an address has been allocated configured state: state after set_configuration wvalue = 1 has been correctly received (a) clear_feature() request a stall response is made in the status stage if the clear_feature() request cannot be cleared, if feature does not exist, or if the target is an interface or an endpoint that does not exist. a stall response is also made if the wlength value is other than 0. ? default state: the correct response is made when the clear_feature() request has been received only if the target is a device or a request for endpoint0. otherwise, a stall response is made in the status stage. ? addressed state: the correct response is made when the clear_feature() request has been received only if the target is a device or a request for endpoint0. otherwise, a stall response is made in the status stage. ? configured state: the correct response is made when the clear_feature() request has been received only if the target is a device or a request for an endpoint that exists. otherwise, a stall response is made in the status stage. when the clear_feature() request has been correctly processed, the corresponding bit of the uf0 clr request register (uf0clr) is set to 1, the enhalt bit of the uf0 epn status register l (uf0ensl) is cleared to 0, and an interrupt is issued (n = 0 to 4, 7, 8). if the clear_feature() request is received when the subject is an endpoint, the toggle bit (that controls switching between data0 and data1) of the corresponding endpoint is always re-set to data0. (b) get_configuration() request a stall response is made in the data stage if any of wvalue, windex, or wlength is other than the values shown in table 11-2. ? default state: the value stored in the uf0 configuration register (uf0cnf) is returned when the get_configuration() request has been received. ? addressed state: the value stored in the uf0cnf register is returned when the get_configuration() request has been received. ? configured state: the value stored in the uf0cnf register is returned when the get_configuration() request has been received.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 581 (c) get_descriptor() request if the subject descriptor has a length that is a multiple of wmaxpacketsize, a null packet is returned to indicate the end of the data stage. if the length of the descriptor at this time is less than the wlength value, the entire descriptor is returned; if the length of the descriptor is greater than the wlength value, the descriptor up to the wlength value is returned. ? default state: the value stored in uf0 device descriptor register n (uf0ddn) and uf0 configuration/interface/endpoint descriptor register m (uf0ciem) is returned (n = 0 to 17, m = 0 to 255) when the get_descriptor() request has been received. ? addressed state: the value stored in the uf0ddn register and uf0ciem register is returned when the get_descriptor() request has been received. ? configured state: the value stored in the uf0ddn register and uf0ciem register is returned when the get_descriptor() request has been received. a descriptor of up to 256 bytes can be stored in the uf0ciem register. to return a descriptor of more than 256 bytes, set the cdcgdst bit of the uf0modc register to 1 and process the get_descriptor() request by fw. store the value of the total number of bytes of the descriptor set by the uf0ciem register ? 1 in the uf0 descriptor length register (uf0dscl). the transfer data is controlled by the value of this data + 1 and wlength. (d) get_interface() request if either of wvalue and wlength is other than that shown in table 11-2, or if windex is other than that set by the uf0 active interface number register (uf0aifn), a stall response is made in the data stage. ? default state: a stall response is made in the data stage when the get_interface() request has been received. ? addressed state: a stall response is made in the data stage when the get_interface() request has been received. ? configured state: the value stored in the uf0 interface n register (uf0ifn) corresponding to the windex value is returned (n = 0 to 4) when the get_interface() request has been received.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 582 (e) get_status() request a stall response is made in the data stage if any of wvalue, windex, or wlength is other than the values shown in table 11-2. a stall response is also made in the data stage if the target is an interface or an endpoint that does not exist. ? default state: the value stored in the target status register note is returned only when the get_status() request has been received and when the request is for a device or endpoint0. otherwise, a stall response is made in the data stage. ? addressed state: the value stored in the target status register note is returned only when the get_status() request has been received and when the request is for a device or endpoint0. otherwise, a stall response is made in the data stage. ? configured state: the value stored in the target status register note is returned only when the get_status() request has been received and when the request is for a device or an endpoint that exists. otherwise, a stall response is made in the data stage. note the target status register is as follows. ? if the target is a device: uf0 device status register l (uf0dstl) ? if the target is endpoint0: uf0 ep0 status register l (uf0e0sl) ? if the target is endpoint n: uf0 epn status register l (uf0ensl) (n = 1 to 4, 7, 8) (f) set_address() request a stall response is made in the status stage if either of windex or wlength is other than the values shown in table 11-2. a stall response is also made if the specified device address is greater than 127. ? default state: the device enters the addressed state and changes the usb address value to be input to sie into a specified address value if the specified address is other than 0 when the set_address() request has been received. if the specified address is 0, the device remains in the default state. ? addressed state: the device enters the default state and returns the usb address value to be input to sie to the default address if the specified address is 0 when the set_address() request has been received. if the specified address is other than 0, the device remains in the addressed state, and changes the usb address value to be input to sie into a specified new address value. ? configured state: the device remains in the configured state and returns the usb address value to be input to sie to the default address if the specified address is 0 when the set_address() request has been received. in this case, the endpoints other than endpoint0 remain valid, and control transfer (in), control transfer (out), bulk transfer and interrupt transfer for an endpoint other than endpoint0 are also acknowledged. if the specified address is other than 0, the device remains in the configured state and changes the usb address value to be input to sie into a specified new address value.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 583 (g) set_configuration() request if any of wvalue, windex, or wlength is other than the values shown in table 11-2, a stall response is made in the status stage. ? default state: the conf bit of the uf0 mode status register (uf0mods) and the uf0 configuration register (uf0cnf) are set to 1 if the specified configuration value is 1 when the set_configuration() request has been received. if the specified configuration value is 0, the conf bit of the uf0mods register and uf0cnf register are cleared to 0. in other words, the device skips the addressed state and moves to the configured state in which it responds to the default address. ? addressed state: the conf bit of the uf0mods register and uf0cnf register are set to 1 and the device enters the configured state if the specified configuration value is 1 when the set_configuration() request has been received. if the specified configuration value is 0, the device remains in the addressed state. ? configured state: the conf bit of the uf0mods register and uf0cnf register are set to 1 and the device returns to the addressed state if the specified configuration value is 0 when the set_configuration() request has been received. if the specified configuration value is 1, the device remains in the configured state. if the set_configuration() request has been correctly processed, the target bit of the uf0 set request register (uf0set) is set to 1, and an interrupt is issued. all halt features are cleared after the set_configuration() request has been completed even if the specified configuration value is the same as the current configuration value. if the set_configuration() request has been correctly processed, the data toggle of all endpoints is always initialized to data0 again (it is defined that the default status, alternative setting 0, is set from when the set_configuration request is received to when the set_interface request is received). (h) set_feature() request a stall response is made in the status stage if the set_feature() request is for a feature that cannot be set or does not exist, or if the target is an interface or an endpoint that does not exist. a stall response is also made if the wlength value is other than 0. ? default state: the correct response is made when the set_feature() request has been received, only if the request is for a device or endpoint0. otherwise, a stall response is made in the status stage. ? addressed state: the correct response is made when the set_feature() request has been received, only if the request is for a device or endpoint0. otherwise, a stall response is made in the status stage. ? configured state: the correct response is made when the set_feature() request has been received, only if the request is for a device or an endpoint that exists. otherwise, a stall response is made in the status stage. when the set_feature() request has been correctly processed, the target bit of the uf0 set request register (uf0set) and the enhalt bit of the uf0 epn status register l (uf0ensl) are set to 1, and an interrupt is issued (n = 0 to 4, 7, 8).
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 584 (i) set_interface() request if wlength is other than the values shown in table 11-2, if windex is other than the value set to the uf0 active interface number register (uf0aifn), or if wvalue is other than the value set to the uf0 active alternative setting register (uf0aas), a stall response is made in the status stage. ? default state: a stall response is made in the status stage when the set_interface() request has been received. ? addressed state: a stall response is made in the status stage when the set_interface() request has been received. ? configured state: null packet is transmitted in the status stage when the set_interface() request has been received. when the set_interface() request has been correctly processed, an interrupt is issued. all the halt features of the endpoint linked to the target interface are cleared after the set_interface() request has been cleared. the data toggle of all the endpoints related to the target interface number is always initialized again to data0. when the currently selected alternative setting is to be changed by correctly processing the set_interface() request, the fifo of the endpoint that is affected is completely cleared, and all the related interrupt sources are also initialized. when the set_interface() request has been completed, the fifo of all the endpoints linked to the target interface are cleared. at the same time, halt feature and data pid are initialized, and the related uf0 int status n register (uf0isn) is cleared to 0 (n = 0 to 4). (only halt feature and data pid are cleared when the set_configuration request has been completed.)
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 585 11.3.2 other requests (1) response and processing the following table shows how other requests are responded to and processed. table 11-3. response and processing of other requests request response and processing get_descriptor string generation of cpudec interrupt request get_status interface automatic stall response clear_feature interface automatic stall response set_feature interface automatic stall response all set_descriptor generation of cpudec interrupt request all other requests generation of cpudec interrupt request
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 586 11.4 register configuration 11.4.1 control registers (1) uf0 ep0nak register (uf0e0n) this register controls nak of endpoint0 (except an automatically executed request). this register can be read or written in 8-bit units (however, bit 0 can only be read). it takes five usb clocks to reflect the status on this register after the uf0fic0 and uf0fic1 registers have been set. if it is necessary to read the status correctly, therefore, separate a write signal that accesses the uf0fic0 and uf0fic1 registers from a read signal that accesses the uf0eps0, uf0eps1, uf0eps2, uf0e0n, and uf0en registers by at least four usb clocks. while nak is being transmitted to endpoint0 read, endpoint2, and endpoint4, a write access to the ep0nkr bit is ignored. 0 uf0e0n 0 5 00 3 0 2 0 1 ep0nkr ep0nkw address fffffe00h after reset 00h 0 4 6 7 bit position bit name function 1 ep0nkr this bit controls nak to the out token to endpoint0 (except an automatically executed request). it is automatically set to 1 by hardware when endpoint0 has correctly received data. it is also cleared to 0 by hardware when the data of the uf0e0r register has been read by fw (counter value = 0). 1: transmit nak. 0: do not transmit nak (default value). set this bit to 1 by fw when data should not be received from the usb bus for some reason even when usbf is ready for receiving data. in this case, usbf continues transmitting nak until this bit is cleared to 0 by fw. this bit is also cleared to 0 as soon as the uf0e0r register has been cleared. 0 ep0nkw this bit indicates how nak to the in token to endpoint0 is controlled (except an automatically executed request). this bit is automatically cleared to 0 by hardware when the data of endpoint0 is transmitted and the host correctly receives the transmitted data. the data of the uf0e0w register is retained until this bit is cleared. therefore, it is not necessary to rewrite this bit even in the case of a retransmission request that is made if the host could not receive data correctly. to send a short packet, be sure to set the e0ded bit of the uf0dend register to 1. this bit is automatically set to 1 when the fifo is full. as soon as the e0ded bit of the uf0dend register is set to 1, the ep0nkw bit is automatically set to 1 at the same time. 1: do not transmit nak. 0: transmit nak (default value). if control transfer enters the status stage while ack cannot be correctly received in the data stage, this bit is cleared to 0 as soon as the uf0e0w register is cleared. this bit is also cleared to 0 when uf0e0w is cleared by fw.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 587 next, the procedure of a setup transaction that uses in/out tokens is explained below. (a) when in token is used (except a request automatically executed by hardware) fw should be used to clear the prot bit of the uf0is1 register to 0 after receiving the cpudec interrupt and before reading data from the uf0e0st register. next, perform processing in accordance with the request and, if it is necessary to return data by an in token, write data to the uf0e0w register. confirm that the prot bit of the uf0is1 register is 0 after writing has been completed, and set the e0ded bit of the uf0dend register to 1. the hardware sends out data at the first in token after the ep0nkw bit has been set to 1. if the prot bit of the uf0is1 register is 1, it indicates that a setup transaction has occurred again before completion of control transfer. in this case, clear the protc bit of the uf0ic1 register to 0 and clear the prot bit of the uf0is1 register to 0, and then read data from the uf0e0st register again. a request received later can be read. (b) when out token is used (except a request automatically executed by hardware) fw should be used to clear the prot bit of the uf0is1 register after receiving the cpudec interrupt and before reading data from the uf0e0st register. confirm that the prot bit of the uf0is1 register is 0 before reading data from the uf0e0r register. if the prot bit is 1, it means that invalid data is retained. clear the fifo by fw (the ep0nkr bit is automatically cleared to 0). if the prot bit of the uf0is1 register is 0, read the data of the uf0e0l register and read as many data from the uf0e0r register as set. when reading data from the uf0e0r register has been completed (when the counter of the uf0e0r register has been cleared to 0), the hardware automatically clears the ep0nkr bit to 0.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 588 (2) uf0 ep0nakall register (uf0e0na) this register controls nak to all the requests of endpoint0. it is also valid for automatically executed requests. this register can be read or written in 8-bit units. 0 uf0e0na 0 5 00 3 0 2 0 1 0 ep0nka address fffffe01h after reset 00h 0 4 6 7 bit position bit name function 0 ep0nka this bit controls nak to a transaction other than a setup transaction to endpoint0 (including an automatically executed request). this bit is manipulated by fw. 1: transmit nak. 0: do not transmit nak (default value). this register is used to prevent a conflict between a write access by fw and a read access from sie when the data used for an automatically executed request is to be changed. it postpones reflecting a write access on this bit from fw while an access from sie is being made. before rewriting the request data register from fw, confirm that this bit has been correctly set to 1. setting this bit to 1 is reflected only in the following cases. ? immediately after usbf has been reset and a setup token has never been received ? immediately after reception of bus reset and a setup token has never been received ? pid of a setup token has been detected ? the stage has been changed to the status stage clearing this bit to 0 is reflected immediately, except while an in token is being received and a nak response is being made. setting the ep0nka bit to 1 is reflected in the above four cases during endpoint0 transfer, but it is reflected immediately after data has been written to the bit while endpoint0 is transferring no data.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 589 (3) uf0 epnak register (uf0en) this register controls nak of endpoints other than endpoint0. this register can be read or written in 8-bit units (however, bits 6 to 4, 1, and 0 can only be read). the bko2nk bit can be written only when the bko2nkm bit of the uf0enm register is 1 and the bko1nk bit can be written only when the bko1nkm bit of the uf0enm register is 1. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4, 7, 8) and the current setting of the interface. it takes five usb clocks to reflect the status on this register after the uf0fic0 and uf0fic1 registers have been set. if it is necessary to read the status correctly, therefore, separate a write signal that accesses the uf0fic0 and uf0fic1 registers from a read signal that accesses the uf0eps0, uf0eps1, uf0eps2, uf0e0n, and uf0en registers by at least four usb clocks. while nak is being transmitted to endpoint0 read, endpoint2, and endpoint4, a write access to the bko1nk and bko2nk bits is ignored. be sure to clear bit 7 to 0. if it is set to 1, the operation is not guaranteed. (1/4) 0 uf0en 0 5 it2nk it1nk 3 bko2nk 2 bko1nk 1 bki2nk bki1nk address fffffe02h after reset 00h 0 4 6 7 bit position bit name function 5 it2nk this bit controls nak to endpoint8 (interrupt 2 transfer). it is automatically set to 1 and transmission is started when the uf0int2 register has become full as a result of writing data to it. to send a short packet that does not make the fifo full, set the it2dend bit of the uf0dend register to 1. as soon as the it2dend bit has been set to 1, this bit is automatically set to 1. 1: do not transmit nak. 0: transmit nak (default value). this bit is also cleared to 0 when the uf0int2 register has been cleared. 4 it1nk this bit controls nak to endpoint7 (interrupt 1 transfer). it is automatically set to 1 and transmission is started when the uf0int1 register has become full as a result of writing data to it. to send a short packet that does not make the fifo full, set the it1dend bit of the uf0dend register to 1. as soon as the it1dend bit has been set to 1, this bit is automatically set to 1. 1: do not transmit nak. 0: transmit nak (default value). this bit is also cleared to 0 when the uf0int1 register has been cleared.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 590 (2/4) bit position bit name function 3 bko2nk this bit controls nak to endpoint4 (bulk 2 transfer (out)). 1: transmit nak. 0: do not transmit nak (default value). this bit is set to 1 only when the fifo connected to the sie side of the uf0bo2 register (64-byte fifo of bank configuration) cannot receive data. it is cleared to 0 when a toggle operation is performed. the bank is changed (toggle operation) when the following conditions are satisfied. ? data correctly received is stored in the fifo connected to the sie side. ? the value of the fifo counter connected to the cpu side is 0 (completion of reading). fw should be used to read data of the uf0bo2l register when it has received the blko2dt interrupt request and read as many data from the uf0bo2 register as the value of that data. to not receive data from the usb bus for some reason even if usbf is ready to receive data, set this bit to 1 by fw. in this case, usbf keeps transmitting nak until the fw clears this bit to 0. this bit is also cleared to 0 as soon as the uf0bo2 register has been cleared. 2 bko1nk this bit controls nak to endpoint2 (bulk 1 transfer (out)). 1: transmit nak. 0: do not transmit nak (default value). this bit is set to 1 only when the fifo connected to the sie side of the uf0bo1 register (64-byte fifo of bank configuration) cannot receive data. it is cleared to 0 when a toggle operation is performed. the bank is changed (toggle operation) when the following conditions are satisfied. ? data correctly received is stored in the fifo connected to the sie side. ? the value of the fifo counter connected to the cpu side is 0 (completion of reading). fw should be used to read data of the uf0bo1l register when it has received the blko1dt interrupt request and read as many data from the uf0bo1 register as the value of that data. to not receive data from the usb bus for some reason even if usbf is ready to receive data, set this bit to 1 by fw. in this case, usbf keeps transmitting nak until the fw clears this bit to 0. this bit is also cleared to 0 as soon as the uf0bo1 register has been cleared. cautions 1. if dma is enabled while data is being read from the uf0bo2 register in the pio mode, a dma request is immediately issued. 2. if the last data of the fifo on the cpu side is read in the dma transfer mode, the dma request signal becomes inactive. 3. if the tc signal is received in the dma transfer mode, the dma request signal becomes inactive.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 591 (3/4) bit position bit name function 1 bki2nk this bit controls nak to endpoint3 (bulk 2 transfer (in)). 1: do not transmit nak. 0: transmit nak (default value). this bit is cleared to 0 only when the fifo connected to the sie side of the uf0bi2 register (64-byte fifo of bank configuration) cannot receive data. it is set to 1 when a toggle operation is performed (the data of the uf0bi2 register is retained until transmission has been correctly completed). the bank is changed (toggle operation) when the following conditions are satisfied. ? data is correctly written to the fifo connected to the cpu bus side (writing has been completed and the fifo is full or the uf0dend register is set). ? the value of the fifo counter connected to the sie side is 0. this bit is automatically set to 1 and data transmission is started when the fifo on the cpu side becomes full and a fifo toggle operation is performed as a result of writing data to the fifo. however, if the fifo on the cpu side becomes full as a result of writing data to it by dma while the bki2t bit of the uf0dend register is cleared to 0, the toggle operation is not performed because the condition of the toggle operation is not satisfied until the bki2ded bit of the uf0dend register is set to 1. to send a short packet that does not make the fifo on the cpu side full, set the bki2ded bit to 1 after completing writing data. when the bki2ded bit is set to 1, a toggle operation is performed and at the same time, this bit is automatically set to 1. this bit is also cleared to 0 as soon as the uf0bi2 register has been cleared. cautions 1. if dma is enabled while data is being written to the uf0bi2 register in the pio mode, a dma request is immediately issued. 2. if 64-byte data is written in the dma transfer mode, the dma request signal becomes inactive. if the bki2nk bit is then set to 1, data is transmitted in synchronization with an in token. the dma request signal becomes active again as long as the dma request is not masked as soon as the fifo is toggled. if the bki2nk bit is not set, data is not transmitted even if an in token has been received. in this case, set the bki2ded bit of the uf0dend register to 1. 3. if the tc signal is received in the dma transfer mode, the dma request signal becomes inactive. at the same time, the dma request is masked. if the bki2nk bit is not set to 1, data is not transmitted even if an in token is received. when the bki2ded bit of the uf0dend register is set to 1 by fw, data is transmitted in synchronization with the in token. to execute dma transfer again, unmask the dma request.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 592 (4/4) bit position bit name function 0 bki1nk this bit controls nak to endpoint1 (bulk 1 transfer (in)). 1: do not transmit nak. 0: transmit nak (default value). this bit is cleared to 0 only when the fifo connected to the sie side of the uf0bi1 register (64-byte fifo of bank configuration) cannot receive data. it is set to 1 when a toggle operation is performed (the data of the uf0bi1 register is retained until transmission has been correctly completed). the bank is changed (toggle operation) when the following conditions are satisfied. ? data is correctly written to the fifo connected to the cpu bus side (writing has been completed and the fifo is full or the uf0dend register is set). ? the value of the fifo counter connected to the sie side is 0. this bit is automatically set to 1 and data transmission is started when the fifo on the cpu side becomes full and a fifo toggle operation is performed as a result of writing data to the fifo. however, if the fifo on the cpu side becomes full as a result of writing data to it by dma while the bki1t bit of the uf0dend register is cleared to 0, the toggle operation is not performed because the condition of the toggle operation is not satisfied until the bki1ded bit of the uf0dend register is set to 1. to send a short packet that does not make the fifo on the cpu side full, set the bki1ded bit to 1 after completing writing data. when the bki1ded bit is set to 1, a toggle operation is performed and at the same time, this bit is automatically set to 1. this bit is also cleared to 0 as soon as the uf0bi1 register has been cleared. cautions 1. if dma is enabled while data is being written to the uf0bi1 register in the pio mode, a dma request is immediately issued. 2. if 64-byte data is written in the dma transfer mode, the dma request signal becomes inactive. if the bki1nk bit is then set to 1, data is transmitted in synchronization with an in token. the dma request signal becomes active again as long as the dma request is not masked as soon as the fifo is toggled. if the bki1nk bit is not set, data is not transmitted even if an in token has been received. in this case, set the bki1ded bit of the uf0dend register to 1. 3. if the tc signal is received in the dma transfer mode, the dma request signal becomes inactive. at the same time, the dma request is masked. if the bki1nk bit is not set to 1, data is not transmitted even if an in token is received. when the bki1ded bit of the uf0dend register is set to 1 by fw, data is transmitted in synchronization with the in token. to execute dma transfer again, unmask the dma request.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 593 (4) uf0 epnak mask register (uf0enm) this register controls masking a write access to the uf0en register. this register can be read or written in 8-bit units (however, bits 6 to 4, 1, and 0 can only be read). be sure to clear bit 7 to 0. if it is set to 1, the operation is not guaranteed. 0 uf0enm 0 5 00 3 bko2nkm 2 bko1nkm 1 00 address fffffe03h after reset 00h 0 4 6 7 bit position bit name function 3 bko2nkm this bit specifies whether a write access to bit 3 (bko2nk) of the uf0en register is masked or not. 1: do not mask. 0: mask (default value). 2 bko1nkm this bit specifies whether a write access to bit 2 (bko1nk) of the uf0en register is masked or not. 1: do not mask. 0: mask (default value).
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 594 (5) uf0 sndsie register (uf0sds) this register performs manipulation such as no handshake. it can directly manipulate the pins of sie. this register can be read or written in 8-bit units. be sure to clear bit 2 to 0. if it is set to 1, the operation is not guaranteed. 0 uf0sds 0 5 00 3 sndstl 2 0 1 0 rsumin address fffffe04h after reset 00h 0 4 6 7 bit position bit name function 3 sndstl this bit makes endpoint0 issue a stall handshake. setting this bit to 1 if a request for cpudec processing is not supported by the system results in a stall handshake response. if an unsupported wvalue is sent by the set_configuration or set_interface request, the hardware sets this bit to 1. if a problem occurs in endpoint0 due to overrun of an automatically executed request, this bit is also set to 1. however, the e0halt bit of the uf0e0sl register is not set to 1. 1: respond with stall handshake. 0: do not respond with stall handshake (default value). this bit is cleared to 0 and the handshake response to the bus is other than stall when the next setup token is received. to set the sndstl bit to 1 by fw, do not write data to the uf0e0w register. depending on the timing of setting this bit, the stall response is not made in time, and it may be made to the next transfer after a nak response has been made. setting this bit is valid only while an fw-executed request is under execution when this bit is set to 1. it is automatically cleared to 0 when the next setup token is received. remark the sndstl bit is valid only for an fw-executed request. 0 rsumin this bit outputs the resume signal onto the usb bus. writing this bit is invalid unless the rmwk bit of the uf0dstl register is set to 1. 1: generate the resume signal. 0: do not generate the resume signal (default value). while this bit is set to 1, the resume signal continues to be generated. clear this bit to 0 by fw after a specific time has elapsed. because the signal is internally sampled at the clock, the operation is guaranteed only while clk is supplied. care must be exercised when clk of the system is stopped.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 595 (6) uf0 clr request register (uf0clr) this register indicates the target of the received clear_feature request. this register is read-only, in 8-bit units. this register is meaningful only when an interrupt request is generated. each bit is set to 1 after completion of the status stage, and automatically cleared to 0 when this register is read. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4, 7, 8) and the current setting of the interface. clrep8 uf0clr clrep7 5 clrep4 clrep3 3 clrep2 2 clrep1 1 clrep0 clrdev address fffffe05h after reset 00h 0 4 6 7 bit position bit name function 7 to 1 clrepn these bits indicate that a clear_feature endpoint n request is received and automatically processed. 1: automatically processed 0: not automatically processed (default value) 0 clrdev this bit indicates that a clear_feature device request is received and automatically processed. 1: automatically processed 0: not automatically processed (default value) remark n = 0 to 4, 7, 8
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 596 (7) uf0 set request register (uf0set) this register indicates the target of the automatically processed set_xxxx (except set_interface) request. this register is read-only, in 8-bit units. this register is meaningful only when an interrupt request is generated. each bit is set to 1 after completion of the status stage, and automatically cleared to 0 when this register is read. setcon uf0set 0 5 00 3 0 2 setep 1 0 setdev address fffffe06h after reset 00h 0 4 6 7 bit position bit name function 7 setcon this bit indicates that a set_configuration request is received and automatically processed. 1: automatically processed 0: not automatically processed (default value) 2 setep this bit indicates that a set_feature endpoint n request (n = 0 to 4, 7, 8) is received and automatically processed. 1: automatically processed 0: not automatically processed (default value) 0 setdev this bit indicates that a set_feature device request is received and automatically processed. 1: automatically processed 0: not automatically processed (default value)
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 597 (8) uf0 ep status 0 register (uf0eps0) this register indicates the usb bus status and the presence or absence of register data. this register is read-only, in 8-bit units. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4, 7, 8) and the current setting of the interface. it takes five usb clocks to reflect the status on this register after the uf0fic0 and uf0fic1 registers have been set. if it is necessary to read the status correctly, therefore, separate writing to the uf0fic0 and uf0fic1 registers from reading from the uf0eps0, uf0eps1, uf0eps2, uf0e0n, and uf0en registers by at least four usb clocks. (1/2) it2 uf0eps0 it1 5 bkout2 bkout1 3 bkin2 2 bkin1 1 ep0w ep0r address fffffe07h after reset 00h 0 4 6 7 bit position bit name function 7, 6 itn these bits indicate that data is in the uf0intn register (fifo). by setting the itnded bit of the uf0dend register to 1, the status in which data is in the uf0intn register can be created even if data is not written to the register (null data transmission). as soon as the itnded bit of the uf0dend register is set to 1 even when the counter of the uf0intn register is 0, this bit is set to 1 by hardware. it is cleared to 0 after correct transmission. 1: data is in the register. 0: no data is in the register (default value). 5, 4 bkoutn these bits indicate that data is in the uf0bon register (fifo) connected to the cpu side. when the fifo configuring the uf0bon register is toggled, this bit is automatically set to 1 by hardware. it is automatically cleared to 0 by hardware when reading the uf0bon register (fifo) connected to the cpu side has been completed (counter value = 0). it is not set to 1 when null data is received (toggling the fifo does not take place either). 1: data is in the register. 0: no data is in the register (default value). 3, 2 bkinn these bits indicate that data is in the uf0bin register (fifo) connected to the cpu side. by setting the bkinded bit of the uf0dend register to 1, the status in which data is in the uf0bin register can be created even if data is not written to the register (null data transmission). as soon as the bkinded bit of the uf0dend register has been set to 1 while the counter of the uf0bin register is 0, this bit is set to 1 by hardware. it is cleared to 0 when a toggle operation is performed. 1: data is in the register. 0: no data is in the register (default value). remark n = 1, 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 598 (2/2) bit position bit name function 1 ep0w this bit indicates that data is in the uf0e0w register (fifo). by setting the e0ded bit of the uf0dend register to 1, the status in which data is in the uf0e0w register can be created even if data is not written to the register (null data transmission). as soon as the e0ded bit of the uf0dend register is set to 1 even when the counter of the uf0e0w register is 0, this bit is set to 1 by hardware. it is cleared to 0 after correct transmission. 1: data is in the register. 0: no data is in the register (default value). 0 ep0r this bit indicates that data is in the uf0e0r register (fifo). it is automatically cleared to 0 by hardware when reading the uf0e0r register (fifo) has been completed (counter value = 0). it is not set to 1 if null data is received. 1: data is in the register. 0: no data is in the register (default value).
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 599 (9) uf0 ep status 1 register (uf0eps1) this register indicates the usb bus status and the presence or absence of register data. this register is read-only, in 8-bit units. rsum uf0eps1 0 5 00 3 0 2 0 1 00 address fffffe08h after reset 00h 0 4 6 7 bit position bit name function 7 rsum this bit indicates that the usb bus is in the resume status. this bit is meaningful only when an interrupt request is generated. 1: suspend status 0: resume status (default value) because sampling is internally performed with the clock, the operation is guaranteed only when clk is supplied. care must be exercised when clk of the system is stopped. the intrsum signal of sie operates even when clk is stopped. it can therefore be supported by making the interrupt control register (rsumic) valid or lowering the frequency of clk to the usbf. this bit is automatically cleared to 0 when it is read.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 600 (10) uf0 ep status 2 register (uf0eps2) this register indicates the usb bus status and the presence or absence of register data. this register is read-only, in 8-bit units. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4, 7, 8) and the current setting of the interface. 0 uf0eps2 halt8 5 halt7 halt4 3 halt3 2 halt2 1 halt1 halt0 address fffffe09h after reset 00h 0 4 6 7 bit position bit name function 6 to 0 haltn these bits indicate that endpoint n is currently stalled. they are set to 1 when a stall condition, such as occurrence of an overrun and reception of an undefined request, is satisfied. these bits are automatically set to 1 by hardware. 1: endpoint is stalled. 0: endpoint is not stalled (default value). the sndstl bit is set to 1 as soon as the halt0 bit has been set to 1 as a result of occurrence of an overrun or reception of an undefined request. if the next setup token is received in this status, the sndstl bit is cleared to 0 and, therefore, the halt0 bit is also cleared to 0. if endpoint0 is stalled by the set_feature endpoint0 request, this bit is not cleared to 0 until the clear_feature endpoint0 request is received or halt feature is cleared by fw. if the get_status endpoint0, clear_feature endpoint0, or set_feature endpoint0 request is received, or if a request to be processed by fw is received due to the cpudec interrupt request, the halt0 bit is masked and cleared to 0, until the next setup token is received. the haltn bit is not cleared to 0 until endpoint n receives the clear_feature endpoint request, halt feature is cleared by the set_interface or set_configuration request to the interface to which the endpoint is linked, or halt feature is cleared by fw. when the set_interface or set_configuration request is correctly processed, the halt feature of all the target endpoints, except endpoint0, is cleared after the request has been processed, even if the wvalue is the same as the currently set value, and these bits are also cleared to 0. halt feature of endpoint0 cannot be cleared if it is set because the stall response is made in response to the set_interface and set_configuration requests. remark n = 0 to 4, 7, 8
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 601 (11) uf0 int status 0 register (uf0is0) this register indicates the interrupt source. if the contents of this register are changed, the intusb0b signal becomes active. this register is read-only, in 8-bit units. if an interrupt request (intusb0b) is generated from usbf, the fw must read this register to identify the interrupt source. each bit of this register is forcibly cleared to 0 when 0 is written to the corresponding bit of the uf0ic0 register. (1/2) uf0is0 rsuspd 5 0 3 dmaed 2 setrq 1 clrrq address fffffe10h after reset 00h 0 ephalt 4 short 6 7 busrst bit position bit name function 7 busrst this bit indicates that bus reset has occurred. 1: bus reset has occurred (interrupt request is generated). 0: not bus reset status (default value) 6 rsuspd this bit indicates that the resume or suspend status has occurred. reference bit 7 of the uf0eps1 register by fw. 1: resume or suspend status has occurred (interrupt request is generated). 0: resume or suspend status has not occurred (default value). 4short this bit indicates that data is read from the fifo of either the uf0bo1 or uf0bo2 register and that the usbspnb signal (n = 2, 4) is active. it is valid only when the fifo is full in the dma mode. 1: usbspnb signal is active (interrupt request is generated). 0: usbspnb signal is not active (default value). identify on which endpoint the operation is performed, by using the uf0dms1 register. this bit is not automatically cleared to 0 even when the uf0dms1 register is read by fw.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 602 (2/2) bit position bit name function 3 dmaed this bit indicates that the dma end (tc) signal for endpoint n (n = 1 to 4, 7, 8) is active. 1: dma end signal for endpoint n has been input (interrupt request is generated). 0: dma end signal for endpoint n has not been input (default value). when this bit is set to 1, the dma request signal for endpoint n becomes inactive. the dma request signal for endpoint n does not become active unless fw enables dma transfer. use the uf0dms0 register to confirm on which endpoint the operation is actually performed. however, this bit is not automatically cleared to 0 even if the uf0dms0 register is read by fw. 2 setrq this bit indicates that the set_xxxx request to be automatically processed has been received and automatically processed (xxxx = address, configuration, feature). 1: set_xxxx request to be automatically processed has been received (interrupt request is generated). 0: set_xxxx request to be automatically processed has not been received (default value). this bit is set to 1 after completion of the status stage. reference the uf0set register to identify what is the target of the request. this bit is not automatically cleared to 0 even if the uf0set register is read by fw. the ephalt bit is also set to 1 when the set_feature endpoint request has been received. 1 clrrq this bit indicates that the clear_feature request has been received and automatically processed. 1: clear_feature request has been received (interrupt request is generated). 0: clear_feature request has not been received (default value). this bit is set to 1 after completion of the status stage. reference the uf0clr register to identify what is the target of the request. this bit is not automatically cleared to 0 even if the uf0clr register is read by fw. 0 ephalt this bit indicates that an endpoint has stalled. 1: endpoint has stalled (interrupt request is generated). 0: endpoint has not stalled (default value). this bit is also set to 1 when an endpoint has stalled by setting fw. identify the endpoint that has stalled, by referencing the uf0eps2 register. this bit is not automatically cleared to 0 even when the clear_feature endpoint, set_interface, or set_configuration request is received. it is not automatically cleared to 0, either, if the next setup token is received in case of overrun of endpoint0. caution even if halt feature of endpoint0 is set and this interrupt request is generated, bit 0 of the uf0eps2 register is masked and cleared to 0 between when a set_feature endpoint0, clear_feature endpoint0, or get_status endpoint0 request, or fw-processed request is received and when a setup token other than the above is received.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 603 (12) uf0 int status 1 register (uf0is1) this register indicates the interrupt source. if the contents of this register are changed, the intusb0b signal becomes active. this register is read-only, in 8-bit units. if an interrupt request (intusb0b) is generated from usbf, the fw must read this register to identify the interrupt source. each bit of this register is forcibly cleared to 0 when 0 is written to the corresponding bit of the uf0ic1 register. however, the suces and stg bits of the uf0is1 register are automatically cleared to 0 when the next setup token has been received. (1/2) uf0is1 cpu dec 5 e0indt 3 suces 2 stg 1 prot address fffffe11h after reset 00h 0 4 e0odt 6 e0in 7 0 bit position bit name function 6 e0in this bit indicates that an in token for endpoint0 has been received and that the hardware has automatically transmitted nak. 1: in token is received and nak is transmitted (interrupt request is generated). 0: in token is not received (default value). 5 e0indt this bit indicates that data has been correctly transmitted from the uf0e0w register. 1: transmission from uf0e0w register is completed (interrupt request is generated). 0: transmission from uf0e0w register is not completed (default value). data is transmitted in synchronization with the in token next to the one that set the ep0nkw bit of the uf0e0n register to 1. this bit is automatically set to 1 by hardware when the host correctly receives that data. it is also set to 1 even if the data is a null packet. this bit is automatically cleared to 0 by hardware when the first write access is made to the uf0e0w register. 4 e0odt this bit indicates that data has been correctly received in the uf0e0r register. 1: data is in uf0e0r register (interrupt request is generated). 0: data is not in uf0e0r register (default value). this bit is automatically set to 1 by hardware when data has been correctly received. at the same time, bit 0 of the uf0eps0 register is also set to 1. if a null packet has been received, this bit is not set to 1. it is automatically cleared to 0 by hardware when the fw reads the uf0e0r register and the value of the uf0e0l register becomes 0. 3 suces this bit indicates that either an fw-processed or hardware-processed request has been received and that the status stage has been correctly completed. 1: control transfer has been correctly processed (interrupt request is generated). 0: control transfer has not been processed correctly (default value). this bit is set to 1 upon completion of the status stage. it is automatically cleared to 0 by hardware when the next setup token is received. this bit is also set to 1 when data with data pid of 0 (null data) is received in the status stage of control transfer.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 604 (2/2) bit position bit name function 2 stg this bit is set to 1 when the stage of control transfer has changed to the status stage. it is valid for both fw-processed and hardware-processed requests. this bit is also set to 1 when the stage of control transfer (without data) has changed to the status stage. 1: status stage (interrupt request is generated) 0: not status stage (default value) this bit is automatically cleared to 0 by hardware when the next setup token is received. it is also set to 1 when the stage of control transfer has changed to the status stage while ack cannot be correctly received in the data stage. in this case, the ep0nkw bit of the uf0e0n register is also cleared to 0 as soon as the uf0e0w register has been cleared, if the fw is processing control transfer (read). 1 prot this bit indicates that a setup token has been received. it is valid for both fw- processed and hardware-processed requests. 1: setup token is correctly received (interrupt request is generated). 0: setup token is not received (default value). this bit is set to 1 when data has been correctly received in the uf0e0st register. clear this bit to 0 by fw when the first read access is made to the uf0e0st register. if it is not cleared to 0 by fw, reception of the next setup token cannot be correctly recognized. this bit is used to accurately recognize that a setup transaction has been executed again during control transfer. if the setup transaction is re-executed during control transfer and if a second request is executed by hardware, the cpudec bit is not set to 1, but the prot bit can be used for recognition of the re-execution. 0 cpudec this bit indicates that the uf0e0st register has a request that is to be decoded by fw. 1: data is in uf0e0st register (interrupt request is generated). 0: data is not in uf0e0st register (default value). this bit is automatically cleared to 0 by hardware when all the data of the uf0e0st register is read.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 605 (13) uf0 int status 2 register (uf0is2) this register indicates the interrupt source. if the contents of this register are changed, the intusb1b signal becomes active. this register is read-only, in 8-bit units. if an interrupt request (intusb1b) is generated from usbf, the fw must read this register to identify the interrupt source. each bit of this register is forcibly cleared to 0 when 0 is written to the corresponding bit of the uf0ic2 register. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1, 3, 7, 8) and the current setting of the interface. bki2in uf0is2 bki2dt 5 bki1in bki1dt 3 0 2 0 1 it2dt it1dt address fffffe12h after reset 00h 0 4 6 7 bit position bit name function 7, 5 bkinin these bits indicate that an in token has been received in the uf0bin register (endpoint m) and that nak has been returned. 1: in token is received and nak is transmitted (interrupt request is generated). 0: in token is not received (default value). 6, 4 bkindt these bits indicate that the fifo of the uf0bin register (endpoint m) has been toggled. this means that data can be written to endpoint m. 1: fifo has been toggled (interrupt request is generated). 0: fifo has not been toggled (default value). the data written to endpoint m is transmitted in synchronization with the in token next to the one that set the bkinnk bit of the uf0en register to 1. when the fifo has been toggled and then data can be written from the cpu, this bit is automatically set to 1 by hardware. it is also set to 1 when the fifo has been toggled, even if the data is a null packet. this bit is automatically cleared to 0 by hardware when the first write access is made to the uf0bin register. 1, 0 itndt these bits indicate that data has been correctly received from the uf0intn register (endpoint x). 1: transmission is completed (interrupt request is generated). 0: transmission is not completed (default value). data is transmitted in synchronization with the in token next to the one that set the itnnk bit of the uf0en register to 1. this bit is automatically set to 1 by hardware when the host has correctly received that data. it is automatically cleared to 0 by hardware when the first write access is made to the uf0intn register. this bit is also set to 1 even when the data is a null packet. remark n = 1, 2 m = 1 and x = 7 where n = 1 m = 3 and x = 8 where n = 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 606 (14) uf0 int status 3 register (uf0is3) this register indicates the interrupt source. if the contents of this register are changed, the intusb1b signal becomes active. this register is read-only, in 8-bit units. if an interrupt request (intusb1b) is generated from usbf, the fw must read this register to identify the interrupt source. each bit of this register is forcibly cleared to 0 when 0 is written to the corresponding bit of the uf0ic3 register. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 2, 4) and the current setting of the interface. (1/2) uf0is3 bko1dt 5 bko2 nak 3 bko1fl 2 bko1nl 1 bko1 nak address fffffe13h after reset 00h 0 4 bko2dt 6 bko2nl 7 bko2fl bit position bit name function 7, 3 bkonfl these bits indicate that data has been correctly received in the uf0bon register (endpoint m) and that both the fifos of the cpu and sie hold the data. 1: received data is in both the fifos of the uf0bon register (interrupt request is generated). 0: received data is not in the fifo on the sie side of the uf0bon register (default value). if data is held in both the fifos of the cpu and sie, these bits are automatically set to 1 by hardware. they are automatically cleared to 0 by hardware when the fifo is toggled. 6, 2 bkonnl these bits indicate that a null packet (packet with a length of 0) has been received in the uf0bon register (endpoint m). 1: null packet is received (interrupt request is generated). 0: null packet is not received (default value). these bits are set to 1 immediately after reception of a null packet when the fifo is empty. they are set to 1 when the fifo on the cpu side has been completely read if data is in that fifo. 5, 1 bkonnak these bits indicate that an out token has been received to the uf0bon register (endpoint m) and that nak has been returned. 1: out token is received and nak is transmitted (interrupt request is generated). 0: out token is not received (default value). remark n = 1, 2 m = 2 where n = 1 m = 4 where n = 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 607 (2/2) bit position bit name function 4, 0 bkondt these bits indicate that data has been correctly received in the uf0bon register (endpoint m). 1: reception has been completed correctly (interrupt request is generated). 0: reception has not been completed (default value). these bits are automatically set to 1 by hardware when data has been correctly received and the fifo has been toggled. at the same time, the corresponding bits of the uf0eps0 register are also set to 1. they are not set to 1 when the data is a null packet. these bits are automatically cleared to 0 by hardware when the value of the uf0bonl register becomes 0 as a result of reading the uf0bon register by fw. these bits are automatically cleared to 0 when all the contents of the fifo on the cpu side have been read. however, the interrupt request is not cleared if data is in the fifo on the sie side at this time, and the intusb1b signal does not become inactive. the signal is kept active if data is successively received. remark n = 1, 2 m = 2 where n = 1 m = 4 where n = 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 608 (15) uf0 int status 4 register (uf0is4) this register indicates the interrupt source. if the contents of this register are changed, the intusb2b signal becomes active. this register is read-only, in 8-bit units. if an interrupt request (intusb2b) is generated from usbf, the fw must read this register to identify the interrupt source. each bit of this register is forcibly cleared to 0 when 0 is written to the corresponding bit of the uf0ic4 register. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4, 7, 8) and the current setting of the interface. 0 uf0is4 0 5 setint 0 3 0 2 0 1 00 address fffffe14h after reset 00h 0 4 6 7 bit position bit name function 5 setint this bit indicates that the set_interface request has been received and automatically processed. 1: the request has been automatically processed (interrupt request is generated). 0: the request has not been automatically processed (default value). the current setting of this bit can be identified by reading the uf0ass or uf0ifn register (n = 0 to 4).
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 609 (16) uf0 int mask 0 register (uf0im0) this register controls masking of the interrupt sources indicated by the uf0is0 register. this register can be read or written in 8-bit units. fw can mask occurrence of an interrupt request from usbf (intusb0b) by writing 1 to the corresponding bit of this register. bus rstm uf0im0 rsu spdm 5 0 3 dma edm 2 set rqm 1 clr rqm ep haltm address fffffe17h after reset 00h 0 4 shortm 6 7 bit position bit name function 7 busrstm this bit masks the bus reset interrupt. 1: mask 0: do not mask (default value) 6 rsuspdm this bit masks the resume/suspend interrupt. 1: mask 0: do not mask (default value) 4 shortm this bit masks the short interrupt. 1: mask 0: do not mask (default value) 3 dmaedm this bit masks the dma_end interrupt. 1: mask 0: do not mask (default value) 2 setrqm this bit masks the set_rq interrupt. 1: mask 0: do not mask (default value) 1 clrrqm this bit masks the clr_rq interrupt. 1: mask 0: do not mask (default value) 0 ephaltm this bit masks the ep_halt interrupt. 1: mask 0: do not mask (default value)
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 610 (17) uf0 int mask 1 register (uf0im1) this register controls masking of the interrupt sources indicated by the uf0is1 register. this register can be read or written in 8-bit units. fw can mask occurrence of an interrupt request from usbf (intusb0b) by writing 1 to the corresponding bit of this register. uf0im1 5 e0 indtm 3 sucesm 2 stgm 1 protm cpu decm address fffffe18h after reset 00h 0 4 e0 odtm 6 e0inm 7 0 bit position bit name function 6 e0inm this bit masks the ep0in interrupt. 1: mask 0: do not mask (default value) 5 e0indtm this bit masks the ep0indt interrupt. 1: mask 0: do not mask (default value) 4 e0odtm this bit masks the ep0outdt interrupt. 1: mask 0: do not mask (default value) 3 sucesm this bit masks the success interrupt. 1: mask 0: do not mask (default value) 2 stgm this bit masks the stg interrupt. 1: mask 0: do not mask (default value) 1 protm this bit masks the protect interrupt. 1: mask 0: do not mask (default value) 0 cpudecm this bit masks the cpudec interrupt. 1: mask 0: do not mask (default value)
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 611 (18) uf0 int mask 2 register (uf0im2) this register controls masking of the interrupt sources indicated by the uf0is2 register. this register can be read or written in 8-bit units. fw can mask occurrence of an interrupt request from usbf (intusb1b) by writing 1 to the corresponding bit of this register. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1, 3, 7, 8) and the current setting of the interface. uf0im2 5 bki1inm 3 0 2 0 1 it2dtm address fffffe19h after reset 00h 0 it1dtm 4 bki1 dtm 6 bki2 dtm 7 bki2inm bit position bit name function 7, 5 bkininm these bits mask the blkinin interrupt. 1: mask 0: do not mask (default value) 6, 4 bkindtm these bits mask the blkindt interrupt. 1: mask 0: do not mask (default value) 1, 0 itndtm these bits mask the intndt interrupt. 1: mask 0: do not mask (default value) remark n = 1, 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 612 (19) uf0 int mask 3 register (uf0im3) this register controls masking of the interrupt sources indicated by the uf0is3 register. this register can be read or written in 8-bit units. fw can mask occurrence of an interrupt request from usbf (intusb1b) by writing 1 to the corresponding bit of this register. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 2, 4) and the current setting of the interface. bko2 flm uf0im3 bko2 nlm 5 bko2 nakm 3 bko1 flm 2 bko1 nlm 1 bko1 nakm bko1 dtm address fffffe1ah after reset 00h 0 4 bko2 dtm 6 7 bit position bit name function 7, 3 bkonflm these bits mask the blkonfl interrupt. 1: mask 0: do not mask (default value) 6, 2 bkonnlm these bits mask the blkonnl interrupt. 1: mask 0: do not mask (default value) 5, 1 bkonnakm these bits mask the blkonnk interrupt. 1: mask 0: do not mask (default value) 4, 0 bkondtm these bits mask the blkondt interrupt. 1: mask 0: do not mask (default value) remark n = 1, 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 613 (20) uf0 int mask 4 register (uf0im4) this register controls masking of the interrupt sources indicated by the uf0is4 register. this register can be read or written in 8-bit units. fw can mask occurrence of an interrupt request from usbf (intusb2b) by writing 1 to the corresponding bit of this register. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4, 7, 8) and the current setting of the interface. 0 uf0im4 0 5 setintm 0 3 0 2 0 1 00 address fffffe1bh after reset 00h 0 4 6 7 bit position bit name function 5 setintm this bit masks the set_int interrupt. 1: mask 0: do not mask (default value)
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 614 (21) uf0 int clear 0 register (uf0ic0) this register controls clearing the interrupt sources indicated by the uf0is0 register. this register is write-only, in 8-bit units. if this register is read, the value ffh is read. fw can clear an interrupt source by writing 0 to the corresponding bit of this register. even a bit that is automatically cleared to 0 by hardware can be cleared by fw before it is cleared by hardware. writing 0 to a bit of this register automatically sets the bit to 1. writing 1 is invalid. bus rstc uf0ic0 rsu spdc 5 1 3 dma edc 2 set rqc 1 clr rqc ep haltc address fffffe1eh after reset ffh 0 4 shortc 6 7 bit position bit name function 7 busrstc this bit clears the bus reset interrupt. 0: clear 6 rsuspdc this bit clears the resume/suspend interrupt. 0: clear 4 shortc this bit clears the short interrupt. 0: clear 3 dmaedc this bit clears the dma_end interrupt. 0: clear 2 setrqc this bit clears the set_rq interrupt. 0: clear 1 clrrqc this bit clears the clr_rq interrupt. 0: clear 0 ephaltc this bit clears the ep_halt interrupt. 0: clear
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 615 (22) uf0 int clear 1 register (uf0ic1) this register controls clearing the interrupt sources indicated by the uf0is1 register. this register is write-only, in 8-bit units. if this register is read, the value ffh is read. fw can clear an interrupt source by writing 0 to the corresponding bit of this register. even a bit that is automatically cleared to 0 by hardware can be cleared by fw before it is cleared by hardware. writing 0 to a bit of this register automatically sets the bit to 1. writing 1 is invalid. uf0ic1 5 e0 indtc 3 sucesc 2 stgc 1 protc cpu decc address fffffe1fh after reset ffh 0 4 e0odtc 6 e0inc 7 1 bit position bit name function 6 e0inc this bit clears the ep0in interrupt. 0: clear 5 e0indtc this bit clears the ep0indt interrupt. 0: clear 4 e0odtc this bit clears the ep0outdt interrupt. 0: clear 3 sucesc this bit clears the success interrupt. 0: clear 2 stgc this bit clears the stg interrupt. 0: clear 1 protc this bit clears the protect interrupt. 0: clear 0 cpudecc this bit clears the cpudec interrupt. 0: clear
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 616 (23) uf0 int clear 2 register (uf0ic2) this register controls clearing the interrupt sources indicated by the uf0is2 register. this register is write-only, in 8-bit units. if this register is read, the value ffh is read. fw can clear an interrupt source by writing 0 to the corresponding bit of this register. even a bit that is automatically cleared to 0 by hardware can be cleared by fw before it is cleared by hardware. writing 0 to a bit of this register automatically sets the bit to 1. writing 1 is invalid. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1, 3, 7, 8) and the current setting of the interface. uf0ic2 5 bki1inc 3 1 2 1 1 it2dtc address fffffe20h after reset ffh 0 it1dtc 4 bki1 dtc 6 bki2 dtc 7 bki2inc bit position bit name function 7, 5 bkininc these bits clear the blkinin interrupt. 0: clear 6, 4 bkindtc these bits clear the blkindt interrupt. 0: clear 1, 0 itndtc these bits clear the intndt interrupt. 0: clear remark n = 1, 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 617 (24) uf0 int clear 3 register (uf0ic3) this register controls clearing the interrupt sources indicated by the uf0is3 register. this register is write-only, in 8-bit units. if this register is read, the value ffh is read. fw can clear an interrupt source by writing 0 to the corresponding bit of this register. even a bit that is automatically cleared to 0 by hardware can be cleared by fw before it is cleared by hardware. writing 0 to a bit of this register automatically sets the bit to 1. writing 1 is invalid. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 2, 4) and the current setting of the interface. bko2 flc uf0ic3 bko2 nlc 5 bko2 nakc bko2 dtc 3 bko1 flc 2 bko1 nlc 1 bko1 nakc bko1 dtc address fffffe21h after reset ffh 0 4 6 7 bit position bit name function 7, 3 bkonflc these bits clear the blkonfl interrupt. 0: clear 6, 2 bkonnlc these bits clear the blkonnl interrupt. 0: clear 5, 1 bkonnakc these bits clear the blkonnk interrupt. 0: clear 4, 0 bkondtc these bits clear the blkondt interrupt. 0: clear remark n = 1, 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 618 (25) uf0 int clear 4 register (uf0ic4) this register controls clearing the interrupt sources indicated by the uf0is4 register. this register is write-only, in 8-bit units. if this register is read, the value ffh is read. fw can clear an interrupt source by writing 0 to the corresponding bit of this register. even a bit that is automatically cleared to 0 by hardware can be cleared by fw before it is cleared by hardware. writing 0 to a bit of this register automatically sets the bit to 1. writing 1 is invalid. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4, 7, 8) and the current setting of the interface. 1 uf0ic4 1 5 setintc 1 3 1 2 1 1 11 address fffffe22h after reset ffh 0 4 6 7 bit position bit name function 5 setintc this bit clears the set_int interrupt. 0: clear
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 619 (26) uf0 int & dmarq register (uf0idr) this register selects reporting via an interrupt request or starting dma. this register can be read or written in 8-bit units. if data exists in either the uf0bo1 or uf0bo1 register, or if data can be written to the uf0bi1 or uf0bi2 register, this register selects whether it is reported to the fw by an interrupt request, or whether starting dma is requested. if starting dma is requested, the dma transfer mode can be selected according to the setting of bits 0 and 1. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4) and the current setting of the interface. be sure to clear bits 3 and 2 to 0. if they are set to 1, the operation is not guaranteed. caution if the target endpoint is not supported by the set_interface request under dma transfer, the dma request signal becomes inactive immediately, and the corresponding bit is automatically cleared to 0 by hardware. (1/2) dqbi2 ms uf0idr dqbi1 ms 5 dqbo2 ms dqbo1 ms 3 0 2 0 1 mode1 address fffffe26h after reset 00h 0 mode0 4 6 7 bit position bit name function 7, 6 dqbinms these bits enable (mask) a write dma transfer request (dma request signal for endpoint m) to the uf0bin register. when these bits are set to 1, the dma request signal for endpoint m becomes active while writing data can be acknowledged. if the dma end signal for endpoint m is input (if the dma controller issues tc), these bits are automatically cleared to 0 by hardware. to continue dma transfer, re-set these bits to 1 by fw. 1: enables active dma request signal for endpoint m (masks bkindt interrupt). 0: disables active dma request signal for endpoint m (default value). 5, 4 dqbonms these bits enable (mask) a read dma transfer request (dma request signal for endpoint x) to the uf0bon register. when these bits are set to 1, the dma request signal for endpoint x becomes active if the data to be read is prepared in the uf0bon register. if the dma end signal for endpoint x is input (if the dma controller issues tc), these bits are automatically cleared to 0 by hardware. they are also cleared to 0 when the usbspxb signal is active. to continue dma transfer, re-set these bits to 1 by fw. 1: enables active dma request signal for endpoint x (masks bkondt interrupt). 0: disables active dma request signal for endpoint x (default value). remark n = 1, 2 m = 1 and x = 2 where n = 1 m = 3 and x = 4 where n = 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 620 (2/2) bit position bit name function these bits select the dma transfer mode. mode1 mode2 mode remark 11setting prohibited operation cannot be guaranteed. 1 0 demand mode dma request signal becomes active as long as there is data. it becomes inactive if there is no more data. 0 x single mode dma request signal becomes inactive each time dma transfer has been executed. 1, 0 mode1, mode0 remark x: don ? t care
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 621 (27) uf0 dma status 0 register (uf0dms0) this register indicates the dma status of endpoint1 to endpoint4. this register is read-only, in 8-bit units. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4) and the current setting of the interface. 0 uf0dms0 0 5 dqe4 dqe3 3 dqe2 2 dqe1 1 00 address fffffe27h after reset 00h 0 4 6 7 bit position bit name function 5 dqe4 this bit indicates that a dma read request is being issued from endpoint4 to memory. 1: dma read request from endpoint4 is being issued. 0: dma read request from endpoint4 is not being issued (default value). 4 dqe3 this bit indicates that a dma write request is being issued from memory to endpoint3. note that, even if data is in endpoint3 (when the fifo is not full and after the bki2ded bit has been set to 1), the dma request signal becomes active immediately and dma transfer is started when the dqbi2ms bit of the uf0idr register is set to 1. 1: dma write request for endpoint3 is being issued. 0: dma write request for endpoint3 is not being issued (default value). 3dqe2 this bit indicates that a dma read request is being issued from endpoint2 to memory. 1: dma read request from endpoint2 is being issued. 0: dma read request from endpoint2 is not being issued (default value). 2 dqe1 this bit indicates that a dma write request is being issued from memory to endpoint1. note that, even if data is in endpoint1 (when the fifo is not full and after the bki1ded bit has been set to 1), the dma request signal becomes active immediately and dma transfer is started when the dqbi1ms bit of the uf0idr register is set to 1. 1: dma write request for endpoint1 is being issued. 0: dma write request for endpoint1 is not being issued (default value).
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 622 (28) uf0 dma status 1 register (uf0dms1) this register indicates the dma status of endpoint1 to endpoint4. this register is read-only, in 8-bit units. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1 to 4) and the current setting of the interface. each bit is automatically cleared to 0 when this register is read. even when this register is read, however, bits 4 and 3 of the uf0is0 register are not cleared to 0. if the target endpoint is no longer supported by the set_interface request, each bit is automatically cleared to 0 by hardware (however, the dma_end interrupt request and short interrupt request are not cleared). dede4 uf0dms1 dspe4 5 dede3 dede2 3 dspe2 2 dede1 1 00 address fffffe28h after reset 00h 0 4 6 7 bit position bit name function 7, 5, 4, 2 deden these bits indicate that the dma end (tc) signal for endpoint n becomes active and dma is stopped while a dma read request is being issued from endpoint n to memory. 1: dma end signal for endpoint n is active. 0: dma end signal for endpoint n is inactive (default value). 6, 3 dspem these bits indicate that, although a dma read request was being issued from endpoint m to memory, dma has been stopped because the received data is a short packet and there is no more data to be transferred. 1: usbspmb signal is active. 0: usbspmb signal is inactive (default value). remark n = 1 to 4 m = 2, 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 623 (29) uf0 fifo clear 0 register (uf0fic0) this register clears each fifo. this register is write-only, in 8-bit units. if this register is read, 00h is read. fw can clear the target fifo by writing 1 to the corresponding bit of this register. the bit to which 1 has been written is automatically cleared to 0. writing 0 to the bit is invalid. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1, 3, 7, 8) and the current setting of the interface. bki2sc uf0fic0 bki2cc 5 bki1sc bki1cc 3 itr2c 2 itr1c 1 ep0wc ep0rc address fffffe30h after reset 00h 0 4 6 7 bit position bit name function 7, 5 bkinsc these bits clear only the fifo on the sie side of the uf0bin register (reset the counter). 1: clear writing these bits is invalid while an in token for endpoint m is being processed with the bkinnk bit set to 1. the bkinnk bit is automatically cleared to 0 by clearing the fifo. make sure that the fifo on the cpu side is empty when these bits are used. 6, 4 bkincc these bits clear only the fifo on the cpu side of the uf0bin register (reset the counter). 1: clear 3, 2 itrnc these bits clear the uf0intn register (reset the counter). 1: clear writing these bits is invalid while an in token for endpoint x is being processed with the itnnk bit set to 1. the itnnk bit is automatically cleared to 0 by clearing the fifo. 1 ep0wc this bit clears the uf0e0w register (resets the counter). 1: clear writing this bit is invalid while an in token for endpoint0 is being processed with the ep0nkw bit set to 1. the ep0nkw bit is automatically cleared to 0 by clearing the fifo. 0 ep0rc this bit clears the uf0e0r register (resets the counter). 1: clear when the ep0nkr bit is set to 1 (except when it has been set by fw), the ep0nkr bit is automatically cleared to 0 by clearing the fifo. remark n = 1, 2 m = 1 and x = 7 where n = 1 m = 3 and x = 8 where n = 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 624 (30) uf0 fifo clear 1 register (uf0fic1) this register clears each fifo. this register is write-only, in 8-bit units. if this register is read, 00h is read. fw can clear the target fifo by writing 1 to the corresponding bit of this register. the bit to which 1 has been written is automatically cleared to 0. writing 0 to the bit is invalid. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 2, 4) and the current setting of the interface. 0 uf0fic1 0 5 00 3 bko2c 2 bko2cc 1 bko1c bko1cc address fffffe31h after reset 00h 0 4 6 7 bit position bit name function 3, 1 bkonc these bits clear the fifos on both the sie and cpu sides of the uf0bon register (reset the counter). 1: clear when the bkonnk bit is set to 1 (except when it has been set by fw), the bkonnk bit is automatically cleared to 0 by clearing the fifo. 2, 0 bkoncc these bits clear only the fifo on the cpu side of the uf0bon register (reset the counter). 1: clear when the bkonnk bit is set to 1 (except when it has been set by fw), the bkonnk bit is automatically cleared to 0 by clearing the fifo. remark n = 1, 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 625 (31) uf0 data end register (uf0dend) this register reports the end of writing to the transmission system. this register is write-only, in 8-bit units (however, bits 7 and 6 can be read and written). if this register is read, 00h is read. fw can start data transfer of the target endpoint by writing 1 to the corresponding bit of this register. the bit to which 1 has been written is automatically cleared to 0. writing 0 to the bit is invalid. the related bits are invalid if each endpoint is not supported by the setting of the uf0enim register (n = 1, 3, 7, 8) and the current setting of the interface. (1/2) bki2t uf0dend bki1t 5 0 it2dend 3 it1dend 2 bki2ded 1 bki1ded e0ded address fffffe35h after reset 00h 0 4 6 7 bit position bit name function 7, 6 bkint these bits specify whether toggling the fifo is automatically executed if the fifo on the cpu side of the uf0bin register becomes full as a result of dma. 1: automatically execute a toggle operation of the fifo as soon as the fifo has become full. 0: do not automatically execute a toggle operation of the fifo even if the fifo becomes full (default value). 4, 3 itndend set these bits to 1 to transmit the data of the uf0intn register. when these bits are set to 1, the itnnk bit is set to 1 and data transfer is executed. 1: transmit a short packet. 0: do not transmit a short packet (default value). if the itrnc bit of the uf0fic0 register is set to 1 and then these bits are set to 1 (counter of uf0intn register = 0 and the corresponding bit of the uf0eps0 register = 1), a null packet (with a data length of 0) is transmitted. if data exists in the uf0intn register and if these bits are set to 1 (counter of uf0intn register 0 and the corresponding bit of the uf0eps0 register = 1), a short packet is transmitted. these bits are automatically controlled by hardware when the fifo is full. remark n = 1, 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 626 (2/2) bit position bit name function 2, 1 bkinded set these bits to 1 when writing transmit data to the uf0bin register has been completed. when these bits are set to 1, the fifo is toggled as soon as possible, the bkinnk bit is set to 1, and data is transferred. 1: transmit a short packet. 0: do not transmit a short packet (default value). these bits control the fifo on the cpu side. if the bkincc bit of the uf0fic0 register is set to 1 and then these bits are set to 1 (counter of uf0bin register = 0), a null packet (with a data length of 0) is transmitted. if data exists in the uf0bin register and if these bits are set to 1 (counter of uf0bin register 0), and if the fifo is not full, a short packet is transmitted. if the fifo on the cpu side of the uf0bin register becomes full as a result of dma, with the pio or bkint bit set to 1, the hardware starts data transmission even if these bits are not set to 1. if the fifo on the cpu side of the uf0bin register becomes full as a result of dma, with the bkint bit cleared to 0, be sure to set these bits to 1 (see 11.4.1 (3) uf0 epnak register (uf0en) ). 0 e0ded set this bit to 1 to transmit data of the uf0e0w register. when this bit is set to 1, the ep0nkw bit is set to 1 and data is transferred. 1: transmit a short packet. 0: do not transmit a short packet (default value). if the ep0wc bit of the uf0fic0 register is set to 1 and if this bit is set to 1 (counter of uf0e0w register = 0 and bit 1 of uf0eps0 register = 1), a null packet (with a data length of 0) is transmitted. if data exists in the uf0e0w register and if this bit is set to 1 (counter of uf0e0w register 0 and bit 1 of the uf0eps0 register = 1), and if the fifo is not full, a short packet is transmitted. remark n = 1, 2
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 627 (32) uf0 gpr register (uf0gpr) this register controls usbf and the usb interface. this register can be read or written in 8-bit units (however, bit 0 can only be written). if this register is read, 00h is read. fw can reset the usbf by writing 1 to bit 0 of this register. this bit is automatically cleared to 0 after 1 has been written to it. writing 0 to this bit is invalid. 0 uf0gpr 0 5 00 3 0 2 0 1 0 mrst address fffffe37h after reset 00h 0 4 6 7 bit position bit name function 0 mrst set this bit to 1 to reset usbf. 1: reset actually, usbf is reset two usb clocks after this bit has been set to 1 by fw and the write signal has become inactive. while the system clock is operating, usbf is reset by this bit in the same manner as by the reset pin (hardware reset).
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 628 (33) uf0 mode control register (uf0modc) this register controls cpudec processing. this register can be read or written in 8-bit units. by setting each bit of this register, the setting of the uf0mods register can be changed. the bit of this register is automatically cleared to 0 only at hardware reset and when the mrst bit of the uf0grp register has been set to 1. even if the bit of this register has automatically been set to 1 by hardware, the setting by fw takes precedence. be sure to clear bits 7 and 5 to 2 to 0. if they are set to 1, the operation is not guaranteed. caution this register is provided for debugging purposes. usually, do not set this register except for verifying the operation or when a special mode is used. uf0modc 5 0 3 0 2 0 1 0 address fffffe3ah after reset 00h 0 0 4 0 6 cdc gdst 7 0 bit position bit name function 6 cdcgdst set this bit to 1 to switch the get_descriptor configuration request to cpudec processing. by setting this bit to 1, the cdcgd bit of the uf0mods register can be forcibly set to 1. 1: forcibly change the get_descriptor configuration request to cpudec processing (sets the cdcgd bit of the uf0mods register to 1). 0: automatically process the get_descriptor configuration request (default value).
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 629 (34) uf0 mode status register (uf0mods) this register indicates the configuration status. this register is read-only, in 8-bit units. 0 uf0mods cdcgd 5 0mpack 3 dflt 2 conf 1 00 address fffffe3ch after reset 00h 0 4 6 7 bit position bit name function 6 cdcgd this bit specifies whether cpudec processing is performed for the get_descriptor configuration request. 1: forcibly change the get_descriptor configuration request to cpudec processing. 0: automatically process the get_descriptor configuration request (default value). 4 mpack this bit indicates the transmit packet size of endpoint0. 1: transmit a packet of other than 8 bytes. 0: transmit a packet of 8 bytes (default value). this bit is automatically set to 1 by hardware after the get_descriptor device request has been processed (on normal completion of the status stage). it is not cleared to 0 until the usbf has been reset (it is not cleared to 0 by bus reset). if this bit is not set to 1, the hardware transfers only the automatically-executed request in 8-byte units. therefore, even if data of more than 8 bytes is sent by the out token to be processed by fw before completion of the get_descriptor device request, the data is correctly received. this bit is ignored if the size of endpoint0 is 8 bytes. 3 dflt this bit indicates the default status (dflt bit = 1). 1: enables response. 0: disables response (always no response) (default value). this bit is automatically set to 1 by bus reset. the transaction for all the endpoints is not responded to until this bit is set to 1. 2 conf this bit indicates whether the set_configuration request has been completed. 1: set_configuration request has been completed. 0: set_configuration request has not been completed (default value). this bit is set to 1 when configuration value = 1 is received by the set_configuration request. unless this bit is set to 1, access to an endpoint other than endpoint0 is ignored. this bit is cleared to 0 when configuration value = 0 is received by the set_configuration request. it is also cleared to 0 when bus reset is detected.
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 630 (35) uf0 active interface number register (uf0aifn) this register sets the valid interface number that correctly responds to the get/set_interface request. because interface 0 is always valid, interfaces 1 to 4 can be selected. this register can be read or written in 8-bit units. addif uf0aifn 0 5 00 3 0 2 0 1 ifno1 ifno0 address fffffe40h after reset 00h 0 4 6 7 bit position bit name function 7 addif this bit allows use of interfaces numbered other than 0. 1: support up to the interface number specified by the ifno1 and ifno0 bits. 0: support only interface 0 (default value). setting bits 1 and 0 of this register is invalid when this bit is not set to 1. these bits specify the range of interface numbers to be supported. ifno1 ifno0 valid interface no. 1 1 0, 1, 2, 3, 4 1 0 0, 1, 2, 3 0 1 0, 1, 2 000, 1 1, 0 ifno1, ifno0
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 631 (36) uf0 active alternative setting register (uf0aas) this register specifies a link between the interface number and alternative setting. this register can be read or written in 8-bit units. usbf of the v850e/me2 can set a five-series alternative setting (alternate setting 0, 1, 2, 3, and 4 can be defined) and a two-series alternative setting (alternative setting 0 and 1 can be defined) for one interface. alt2 uf0aas ifal21 5 ifal20 alt2en 3 alt5 2 ifal51 1 ifal50 alt5en address fffffe41h after reset 00h 0 4 6 7 bit position bit name function 7, 3 altn these bits specify whether an n-series alternative setting is linked with interface 0. when these bits are set to 1, the setting of the ifaln1 and ifaln0 bits is invalid. 1: link n-series alternative setting with interface 0. 0: do not link n-series alternative setting with interface 0 (default value). these bits specify the interface number to be linked with the n-series alternative setting. if the linked interface number is outside the range specified by the uf0aifn register, the n-series alternative setting is invalid (altnen bit = 0). ifaln1 ifaln0 interface number to be linked 1 1 links interface 4. 1 0 links interface 3. 0 1 links interface 2. 0 0 links interface 1. 6, 5, 2, 1 ifaln1, ifaln0 do not link a five-series alternative setting and a two-series alternative setting with the same interface number. 4, 0 altnen these bits validate the n-series alternative setting. unless these bits are set to 1, the setting of the altn, ifaln1, and ifaln0 bits is invalid. 1: validate the n-series alternative setting. 0: do not validate the n-series alternative setting (default value). remark n = 2, 5 for example, when the uf0aifn register is set to 82h and the uf0aas register is set to 15h, interfaces 0, 1, 2, and 3 are valid. interfaces 0 and 2 support only alternative setting 0. interface 1 supports alternative setting 0 and 1, and interface 3 supports alternative setting 0, 1, 2, 3, and 4. with this setting, requests get_interface windex = 0/1/2/3, set_interface wvalue = 0 & windex = 0/2, set_interface wvalue = 0/1 & windex = 1, and set_interface wvalue = 0/1/2/3/4 & windex = 3 are automatically responded to, and a stall response is made to the other get/set_interface requests.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 632 (37) uf0 alternative setting status register (uf0ass) this register indicates the current status of the alternative setting. this register is read-only, in 8-bit units. check this register when the set_int interrupt request has been issued. the value received by the set_interface request is reflected on the uf0ifn register (n = 0 to 4) as well as on this register. 0 uf0ass 0 5 00 3 al5st3 2 al5st2 1 al5st1 al2st address fffffe42h after reset 00h 0 4 6 7 bit position bit name function these bits indicate the current status of the five-series alternative setting. al5st3 al5st2 al5st1 selected alternative setting number 1 0 0 alternative setting 4 0 1 1 alternative setting 3 0 1 0 alternative setting 2 0 0 1 alternative setting 1 0 0 0 alternative setting 0 3 to 1 al5st3 to al5st1 0 al2st this bit indicates the current status of the two-series alternative setting (selected alternative setting number). 1: alternative setting 1 0: alternative setting 0
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 633 (38) uf0 endpoint 1 interface mapping register (uf0e1im) this register specifies for which interface and alternative setting endpoint1 is valid. this register can be read or written in 8-bit units. the setting of this register and the alternative setting selected by the set_interface request indicate whether endpoint1 is currently valid, and the hardware determines how the get_status/clear_feature/set_feature endpoint1 request and the in transaction to endpoint1 are responded to, and whether the related bits are valid or invalid. e1en2 uf0e1im e1en1 5 e1en0 e12al1 3 e15al4 2 e15al3 1 e15al2 e15al1 address fffffe43h after reset 00h 0 4 6 7 bit position bit name function these bits set a link between the interface of endpoint1 and the two-/five-series alternative setting. the endpoint is linked with alternative setting 0. the endpoint linked with alternative setting 0 cannot be excluded from alternative setting 1 to 4. e1en2 e1en1 e1en0 link status 111 110 not linked with interface 1 0 1 linked with interface 4 and alternative setting 0 1 0 0 linked with interface 3 and alternative setting 0 0 1 1 linked with interface 2 and alternative setting 0 0 1 0 linked with interface 1 and alternative setting 0 0 0 1 linked with interface 0 and alternative setting 0 0 0 0 not linked with interface (default value) 7 to 5 e1en2 to e1en0 when these bits are set to 110 or 111, they are invalid even if the e12al1 bit is cleared to 0. if the endpoint is linked, setting of the conf bit of the uf0mods register to 1 indicates that endpoint1 is valid. 4 e12al1 this bit validates endpoint1 when the two-series alternative setting and the alternative setting of the linked interface are set to 1. 1: validate the endpoint when alternative setting 1 is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting 1 is set with conf bit = 1 (default value). this bit is valid when the e15al4 to e15al1 bits are 0000. 3 to 0 e15aln these bits validate endpoint1 when the five-series alternative setting and the alternative setting of the linked interface are set to n. 1: validate the endpoint when alternative setting n is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting n is set with conf bit = 1 (default value). remark n = 1 to 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 634 (39) uf0 endpoint 2 interface mapping register (uf0e2im) this register specifies for which interface and alternative setting endpoint2 is valid. this register can be read or written in 8-bit units. the setting of this register and the alternative setting selected by the set_interface request indicate whether endpoint2 is currently valid, and the hardware determines how the get_status/clear_feature/set_feature endpoint2 request and the out transaction to endpoint2 are responded to, and whether the related bits are valid or invalid. e2en2 uf0e2im e2en1 5 e2en0 e22al1 3 e25al4 2 e25al3 1 e25al2 e25al1 address fffffe44h after reset 00h 0 4 6 7 bit position bit name function these bits set a link between the interface of endpoint2 and the two-/five-series alternative setting. the endpoint is linked with alternative setting 0. the endpoint linked with alternative setting 0 cannot be excluded from alternative setting 1 to 4. e2en2 e2en1 e2en0 link status 111 110 not linked with interface 1 0 1 linked with interface 4 and alternative setting 0 1 0 0 linked with interface 3 and alternative setting 0 0 1 1 linked with interface 2 and alternative setting 0 0 1 0 linked with interface 1 and alternative setting 0 0 0 1 linked with interface 0 and alternative setting 0 0 0 0 not linked with interface (default value) 7 to 5 e2en2 to e2en0 when these bits are set to 110 or 111, they are invalid even if the e22al1 bit is cleared to 0. if the endpoint is linked, setting of the conf bit of the uf0mods register to 1 indicates that endpoint2 is valid. 4 e22al1 this bit validates endpoint2 when the two-series alternative setting and the alternative setting of the linked interface are set to 1. 1: validate the endpoint when alternative setting 1 is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting 1 is set with conf bit = 1 (default value). this bit is valid when the e25al4 to e25al1 bits are 0000. 3 to 0 e25aln these bits validate endpoint2 when the five-series alternative setting and the alternative setting of the linked interface are set to n. 1: validate the endpoint when alternative setting n is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting n is set with conf bit = 1 (default value). remark n = 1 to 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 635 (40) uf0 endpoint 3 interface mapping register (uf0e3im) this register specifies for which interface and alternative setting endpoint3 is valid. this register can be read or written in 8-bit units. the setting of this register and the alternative setting selected by the set_interface request indicate whether endpoint3 is currently valid, and the hardware determines how the get_status/clear_feature/set_feature endpoint3 request and the in transaction to endpoint3 are responded to, and whether the related bits are valid or invalid. e3en2 uf0e3im e3en1 5 e3en0 e32al1 3 e35al4 2 e35al3 1 e35al2 e35al1 address fffffe45h after reset 00h 0 4 6 7 bit position bit name function these bits set a link between the interface of endpoint3 and the two-/five-series alternative setting. the endpoint is linked with alternative setting 0. the endpoint linked with alternative setting 0 cannot be excluded from alternative setting 1 to 4. e3en2 e3en1 e3en0 link status 111 110 not linked with interface 1 0 1 linked with interface 4 and alternative setting 0 1 0 0 linked with interface 3 and alternative setting 0 0 1 1 linked with interface 2 and alternative setting 0 0 1 0 linked with interface 1 and alternative setting 0 0 0 1 linked with interface 0 and alternative setting 0 0 0 0 not linked with interface (default value) 7 to 5 e3en2 to e3en0 when these bits are set to 110 or 111, they are invalid even if the e32al1 bit is cleared to 0. if the endpoint is linked, setting of the conf bit of the uf0mods register to 1 indicates that endpoint3 is valid. 4 e32al1 this bit validates endpoint3 when the two-series alternative setting and the alternative setting of the linked interface are set to 1. 1: validate the endpoint when alternative setting 1 is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting 1 is set with conf bit = 1 (default value). this bit is valid when the e35al4 to e35al1 bits are 0000. 3 to 0 e35aln these bits validate endpoint3 when the five-series alternative setting and the alternative setting of the linked interface are set to n. 1: validate the endpoint when alternative setting n is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting n is set with conf bit = 1 (default value). remark n = 1 to 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 636 (41) uf0 endpoint 4 interface mapping register (uf0e4im) this register specifies for which interface and alternative setting endpoint4 is valid. this register can be read or written in 8-bit units. the setting of this register and the alternative setting selected by the set_interface request indicate whether endpoint4 is currently valid, and the hardware determines how the get_status/clear_feature/set_feature endpoint4 request and the out transaction to endpoint4 are responded to, and whether the related bits are valid or invalid. e4en2 uf0e4im e4en1 5 e4en0 e42al1 3 e45al4 2 e45al3 1 e45al2 e45al1 address fffffe46h after reset 00h 0 4 6 7 bit position bit name function these bits set a link between the interface of endpoint4 and the two-/five-series alternative setting. the endpoint is linked with alternative setting 0. the endpoint linked with alternative setting 0 cannot be excluded from alternative setting 1 to 4. e4en2 e4en1 e4en0 link status 111 110 not linked with interface 1 0 1 linked with interface 4 and alternative setting 0 1 0 0 linked with interface 3 and alternative setting 0 0 1 1 linked with interface 2 and alternative setting 0 0 1 0 linked with interface 1 and alternative setting 0 0 0 1 linked with interface 0 and alternative setting 0 0 0 0 not linked with interface (default value) 7 to 5 e4en2 to e4en0 when these bits are set to 110 or 111, they are invalid even if the e42al1 bit is cleared to 0. if the endpoint is linked, setting of the conf bit of the uf0mods register to 1 indicates that endpoint4 is valid. 4 e42al1 this bit validates endpoint4 when the two-series alternative setting and the alternative setting of the linked interface are set to 1. 1: validate the endpoint when alternative setting 1 is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting 1 is set with conf bit = 1 (default value). this bit is valid when the e45al4 to e45al1 bits are 0000. 3 to 0 e45aln these bits validate endpoint4 when the five-series alternative setting and the alternative setting of the linked interface are set to n. 1: validate the endpoint when alternative setting n is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting n is set with conf bit = 1 (default value). remark n = 1 to 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 637 (42) uf0 endpoint 7 interface mapping register (uf0e7im) this register specifies for which interface and alternative setting endpoint7 is valid. this register can be read or written in 8-bit units. the setting of this register and the alternative setting selected by the set_interface request indicate whether endpoint7 is currently valid, and the hardware determines how the get_status/clear_feature/set_feature endpoint7 request and the in transaction to endpoint7 are responded to, and whether the related bits are valid or invalid. e7en2 uf0e7im e7en1 5 e7en0 e72al1 3 e75al4 2 e75al3 1 e75al2 e75al1 address fffffe49h after reset 00h 0 4 6 7 bit position bit name function these bits set a link between the interface of endpoint7 and the two-/five-series alternative setting. the endpoint is linked with alternative setting 0. the endpoint linked with alternative setting 0 cannot be excluded from alternative setting 1 to 4. e7en2 e7en1 e7en0 link status 111 110 not linked with interface 1 0 1 linked with interface 4 and alternative setting 0 1 0 0 linked with interface 3 and alternative setting 0 0 1 1 linked with interface 2 and alternative setting 0 0 1 0 linked with interface 1 and alternative setting 0 0 0 1 linked with interface 0 and alternative setting 0 0 0 0 not linked with interface (default value) 7 to 5 e7en2 to e7en0 when these bits are set to 110 or 111, they are invalid even if the e72al1 bit is cleared to 0. if the endpoint is linked, setting of the conf bit of the uf0mods register to 1 indicates that endpoint7 is valid. 4 e72al1 this bit validates endpoint7 when the two-series alternative setting and the alternative setting of the linked interface are set to 1. 1: validate the endpoint when alternative setting 1 is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting 1 is set with conf bit = 1 (default value). this bit is valid when the e75al4 to e75al1 bits are 0000. 3 to 0 e75aln these bits validate endpoint7 when the five-series alternative setting and the alternative setting of the linked interface are set to n. 1: validate the endpoint when alternative setting n is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting n is set with conf bit = 1 (default value). remark n = 1 to 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 638 (43) uf0 endpoint 8 interface mapping register (uf0e8im) this register specifies for which interface and alternative setting endpoint8 is valid. this register can be read or written in 8-bit units. the setting of this register and the alternative setting selected by the set_interface request indicate whether endpoint8 is currently valid, and the hardware determines how the get_status/clear_feature/set_feature endpoint8 request and the in transaction to endpoint8 are responded to, and whether the related bits are valid or invalid. e8en2 uf0e8im e8en1 5 e8en0 e82al1 3 e85al4 2 e85al3 1 e85al2 e85al1 address fffffe4ah after reset 00h 0 4 6 7 bit position bit name function these bits set a link between the interface of endpoint8 and the two-/five-series alternative setting. the endpoint is linked with alternative setting 0. the endpoint linked with alternative setting 0 cannot be excluded from alternative setting 1 to 4. e8en2 e8en1 e8en0 link status 111 110 not linked with interface 1 0 1 linked with interface 4 and alternative setting 0 1 0 0 linked with interface 3 and alternative setting 0 0 1 1 linked with interface 2 and alternative setting 0 0 1 0 linked with interface 1 and alternative setting 0 0 0 1 linked with interface 0 and alternative setting 0 0 0 0 not linked with interface (default value) 7 to 5 e8en2 to e8en0 when these bits are set to 110 or 111, they are invalid even if the e82al1 bit is cleared to 0. if the endpoint is linked, setting of the conf bit of the uf0mods register to 1 indicates that endpoint8 is valid. 4 e82al1 this bit validates endpoint8 when the two-series alternative setting and the alternative setting of the linked interface are set to 1. 1: validate the endpoint when alternative setting 1 is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting 1 is set with conf bit = 1 (default value). this bit is valid when the e85al4 to e85al1 bits are 0000. 3 to 0 e85aln these bits validate endpoint8 when the five-series alternative setting and the alternative setting of the linked interface are set to n. 1: validate the endpoint when alternative setting n is set with conf bit = 1. 0: do not validate the endpoint even when alternative setting n is set with conf bit = 1 (default value). remark n = 1 to 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 639 11.4.2 data hold registers (1) uf0 ep0 read register (uf0e0r) the uf0e0r register is a 64-byte fifo that stores the out data sent from the host in the data stage of control transfer to/from endpoint0. this register is read-only, in 8-bit units. a write access to this register is ignored. the hardware automatically transfers data to the uf0e0r register when it has received the data from the host. when the data has been correctly received, the e0odt bit of the uf0is1 register is set to 1. the uf0e0l register holds the quantity of the received data, and an interrupt request (intusb0b) is issued. the uf0e0l register always updates the length of the received data while it is receiving data. if the final transfer is correct reception, the interrupt request is generated. if the reception is abnormal, the uf0e0l register is cleared to 0 and the interrupt request is not generated. the data held by the uf0e0r register must be read by fw up to the value of the amount of data read by the uf0e0l register. check that all data has been read by using the ep0r bit of the uf0eps0 register (ep0r = 0 when all data has been read). if the value of the uf0e0l register is 0, the ep0nkr bit of the uf0e0n register is cleared to 0, and the uf0e0r register is ready for reception. the uf0e0r register is cleared when the next setup token has been received. caution read all the data stored. to discard some data, clear the fifo. e0r7 uf0e0r e0r6 5 e0r5 e0r4 3 e0r3 2 e0r2 1 e0r1 e0r0 address fffffe80h after reset undefined 0 4 6 7 bit position bit name function 7 to 0 e0r7 to e0r0 these bits store the out data sent from the host in the data stage of control transfer to/from endpoint0. the operation of the uf0e0r register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 640 figure 11-1. operation of uf0e0r register status of uf0e0r register normal completion of reception normal completion of reception abnormal reception fifo hard- ware clear ep0nkr bit of uf0e0n register ep0r bit of uf0eps0 register e0odt bit of uf0is1 register hardware clear hardware clear reading fifo starts reading fifo completed (2) uf0 ep0 length register (uf0e0l) the uf0e0l register stores the data length held by the uf0e0r register. this register is read-only, in 8-bit units. a write access to this register is ignored. the uf0e0l register always updates the length of the received data while it is receiving data. if the final transfer is abnormal reception, the uf0e0l register is cleared to 0 and the interrupt request is not generated. the interrupt request is generated only when the reception is normal, and the fw can read as many data from the uf0e0r register as the value read from the uf0e0l register. the value of the uf0e0l register is decremented each time the uf0e0r register has been read. e0l7 uf0e0l e0l6 5 e0l5 e0l4 3 e0l3 2 e0l2 1 e0l1 e0l0 address fffffe81h after reset 00h 0 4 6 7 bit position bit name function 7 to 0 e0l7 to e0l0 these bits store the data length held by the uf0e0r register.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 641 (3) uf0 ep0 setup register (uf0e0st) the uf0e0st register holds the setup data sent from the host. this register is read-only, in 8-bit units. a write access to this register is ignored. the uf0e0st register always writes data when a setup transaction has been received. the hardware sets the prot bit of the uf0is1 register when it has correctly received the setup transaction. it sets the cpudec bit of the uf0is1 register in the case of an fw-processed request. then an interrupt request (intusb0b) is issued. in the case of an fw-processed request, be sure to read the request in 8-byte units. if it is not read in 8-byte units, the subsequent requests cannot be correctly decoded. the read counter of the uf0e0st register is not cleared even when bus reset is received. always read this counter in 8-byte units regardless of whether bus reset is received or not. because the uf0e0st register always enables writing, the hardware overwrites data to this register even if a setup transaction is received while the data of the register is being read. even if the setup transaction cannot be correctly received, the cpudec interrupt request and protect interrupt request are not generated, but the previous data is discarded. if a setup token of less than 8 bytes is received, however, the received setup token is discarded, and the previously received setup data is retained. if the setup token is received more than once when control transfer is executed once, be sure to check the prot bit of the uf0is1 register under the conditions below. if prot bit = 1, read the uf0e0st register again because the setup transaction has been received more than once. <1> if a request is decoded by fw and the uf0e0r register is read or the uf0e0w register is written <2> when preparing for a stall response for the request to which the decode result does not correspond caution be sure to read all the stored data. the uf0e0st register is always updated by the request in the setup transaction. e0s7 uf0e0st e0s6 5 e0s5 e0s4 3 e0s3 2 e0s2 1 e0s1 e0s0 address fffffe82h after reset 00h 0 4 6 7 bit position bit name function 7 to 0 e0s7 to e0s0 these bits hold the setup data sent from the host. the operation of the uf0e0st register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 642 figure 11-2. operation of uf0e0st register (a) normal status of uf0e0st register completion of normal reception of setup token completion of normal reception of setup token cpudec bit of uf0is1 register prot bit of uf0is1 register hardware clear fw processing int clear (fw clear) completion of decoding request completion of reading fifo completion of decoding request completion of reading fifo int clear (fw clear) hardware processing (b) when setup transaction is received more than once status of uf0e0st register completion of normal reception of setup token start of reception of second setup token completion of normal reception of second setup token cpudec bit of uf0is1 register prot bit of uf0is1 register hardware clear int clear (fw clear) int clear (fw clear) completion of decoding request completion of decoding request completion of reading fifo hardware clear on completion of reading 8 bytes
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 643 (4) uf0 ep0 write register (uf0e0w) the uf0e0w register is a 64-byte fifo that stores the in data (passes it to sie) sent from the host to endpoint0 in the data stage. this register is write-only, in 8-bit units. when this register is read, 00h is read. the hardware transmits data to the usb bus in synchronization with an in token only when the ep0nkw bit of the uf0e0n register is set to 1 (when nak is not transmitted). when data is transmitted and when the host correctly receives the data, the ep0nkw bit of the uf0e0n register is automatically cleared to 0 by hardware. a short packet is transmitted when data is written to the uf0e0w register and the e0ded bit of the uf0dend register is set to 1 (ep0w bit of the uf0eps0 register = 1 (data exists)). a null packet is transmitted when the uf0e0w register is cleared and the e0ded bit of the uf0dend register is set to 1 (ep0w bit of the uf0eps0 register = 1 (data exists)). the uf0e0w register is cleared to 0 when the next setup token is received while transmission has not been completed yet. if the stage of control transfer (read) changes to the status stage while ack has not been correctly received in the data stage, the uf0e0w register is automatically cleared to 0. at the same time, it is also cleared to 0 if the ep0nkw bit of the uf0e0n register is 1. if the uf0e0w register is read while no data is in it, 00h is read. e0w7 uf0e0w e0w6 5 e0w5 e0w4 3 e0w3 2 e0w2 1 e0w1 e0w0 address fffffe83h after reset undefined 0 4 6 7 bit position bit name function 7 to 0 e0w7 to e0w0 these bits store the in data sent from the host to endpoint0 in the data stage. the operation of the uf0e0w register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 644 figure 11-3. operation of uf0e0w register (a) 16-byte transmission status of uf0e0w register trans- mission starts trans- mission completed ack reception trans- mission starts trans- mission completed re- trans- mission starts ack reception ack cannot be received ep0nkw bit of uf0en register ep0w bit of uf0eps0 register e0indt bit of uf0is1 register fifo full hardware clear fifo full 16-byte transfer 16-byte transfer re-transfer int clear (fw clear) writing fifo starts writing fifo completed writing fifo starts writing fifo completed counter reloaded (b) when null packet or short packet is transmitted status of uf0e0w register transmission starts trans- mission completed ack reception transmission starts trans- mission completed ack reception ep0nkw bit of uf0en register ep0w bit of uf0eps0 register e0indt bit of uf0is1 register hardware clear e0ded bit of uf0dend register is set. e0ded bit of uf0dend register is set. short packet transfer transfer of null packet int clear (fw clear) writing fifo starts writing fifo completed fifo fw clear
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 645 (5) uf0 bulk out 1 register (uf0bo1) the uf0bo1 register is a 64-byte 2 fifo that stores data for endpoint2. this register consists of two banks of 64-byte fifos each of which performs a toggle operation and repeatedly connects the buses on the sie and cpu sides. the toggle operation takes place when data is in the fifo on the sie side and when no data is in the fifo on the cpu side (counter value = 0). this register is read-only, in 8-bit units. a write access to this register is ignored. when the hardware receives data for endpoint2 from the host, it automatically transfers the data to the uf0bo1 register. when the register correctly receives the data, a fifo toggle operation occurs. as a result, the bko1dt bit of the uf0is3 register is set to 1, the quantity of the received data is held by the uf0bo1l register, and an interrupt request or dma request is issued to the cpu. whether the interrupt request or dma request is issued can be selected by using the dqbo1ms bit of the uf0idr register. read the data held by the uf0bo1 register by fw, up to the value of the amount of data read by the uf0bo1l register. when the correct received data is held by the fifo connected to the sie side and the value of the uf0bo1l register reaches 0, the toggle operation of the fifo occurs, and the bko1nk bit of the uf0en register is automatically cleared to 0. if data greater than the value of the uf0bo1l register is read and if the fifo toggle condition is satisfied, the toggle operation of the fifo occurs. as a result, the next packet may be read by mistake. note that, if the toggle condition is not satisfied, the first data is repeatedly read. if overrun data is received while data is held by the fifo connected to the cpu side, endpoint2 stalls, and the fifo on the cpu side is cleared. when the uf0bo1 register is read while no data is in it, an undefined value is read. caution be sure to read all the data stored in this register. bko17 uf0bo1 bko16 5 bko15 bko14 3 bko13 2 bko12 1 bko11 bko10 address fffffe84h after reset undefined 0 4 6 7 bit position bit name function 7 to 0 bko17 to bko10 these bits store data for endpoint2. the operation of the uf0bo1 register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 646 figure 11-4. operation of uf0bo1 register (1/2) (a) operation example 1 sie side cpu side status of uf0bo1 register reception completed fifo toggle fifo toggle ack transmission transmission starts transmission completed ack transmission bko1nk bit of uf0en register bko1fl bit of uf0is3 register bkout1 bit of uf0eps0 register bko1dt bit of uf0is3 register transfer of data less than 64 bytes 64-byte transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 reading fifo starts reading fifo completed reading fifo starts reading fifo completed f w clear fifo_0 fifo_1
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 647 figure 11-4. operation of uf0bo1 register (2/2) (b) operation example 2 sie side cpu side status of uf0bo1 register reception completed transmission starts null reception completed null reception completed fifo toggle fifo toggle ack transmission transmission starts reception completed ack transmission bko1nl bit of uf0is3 register bkout1 bit of uf0eps0 register bko1dt bit of uf0is3 register transfer of data less than 64 bytes 0-byte transfer 0-byte transfer 64-byte transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 reading fifo starts reading fifo completed fw clear fw clear fifo_0 fifo_1
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 648 (6) uf0 bulk out 1 length register (uf0bo1l) the uf0bo1l register stores the length of the data held by the uf0bo1 register. this register is read-only, in 8-bit units. a write access to this register is ignored. the uf0bo1l register always updates the received data length while it is receiving data. if the final transfer is abnormal reception, the uf0bo1l register is cleared to 00h, and an interrupt request is not generated. only if the reception is normal, the interrupt request is generated, and fw can read as much data from the uf0bo1 register as the value read from the uf0bo1l register. the value of the uf0bo1l register is decremented each time the uf0bo1 register has been read. bko1l7 uf0bo1l bko1l6 5 bko1l5 bko1l4 3 bko1l3 2 bko1l2 1 bko1l1 bko1l0 address fffffe85h after reset 00h 0 4 6 7 bit position bit name function 7 to 0 bko1l7 to bko1l0 these bits store the length of the data held by the uf0bo1 register.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 649 (7) uf0 bulk out 2 register (uf0bo2) the uf0bo2 register is a 64-byte 2 fifo that stores data for endpoint4. this register consists of two banks of 64-byte fifos each of which performs a toggle operation and repeatedly connects the buses on the sie and cpu sides. the toggle operation takes place when data is in the fifo on the sie side and when no data is in the fifo on the cpu side (counter value = 0). this register is read-only, in 8-bit units. a write access to this register is ignored. when the hardware receives data for endpoint4 from the host, it automatically transfers the data to the uf0bo2 register. when the register correctly receives the data, a fifo toggle operation occurs. as a result, the bko2dt bit of the uf0is3 register is set to 1, the quantity of the received data is held by the uf0bo2l register, and an interrupt request or dma request is issued to the cpu. whether the interrupt request or dma request is issued can be selected by using the dqbo2ms bit of the uf0idr register. read the data held by the uf0bo2 register by fw, up to the value of the amount of data read by the uf0bo2l register. when the correct received data is held by the fifo connected to the sie side and the value of the uf0bo2l register reaches 0, the toggle operation of the fifo occurs, and the bko2nk bit of the uf0en register is automatically cleared to 0. if data greater than the value of the uf0bo2l register is read and if the fifo toggle condition is satisfied, the toggle operation of the fifo occurs. as a result, the next packet may be read by mistake. note that, if the toggle condition is not satisfied, the first data is repeatedly read. if overrun data is received while data is held by the fifo connected to the cpu side, endpoint4 stalls, and the fifo on the cpu side is cleared. when the uf0bo2 register is read while no data is in it, an undefined value is read. caution be sure to read all the data stored in this register. bko27 uf0bo2 bko26 5 bko25 bko24 3 bko23 2 bko22 1 bko21 bko20 address fffffe86h after reset undefined 0 4 6 7 bit position bit name function 7 to 0 bko27 to bko20 these bits store data for endpoint4. the operation of the uf0bo2 register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 650 figure 11-5. operation of uf0bo2 register (1/2) (a) operation example 1 sie side cpu side status of uf0bo2 register reception completed fifo toggle fifo toggle ack transmission transmission starts reception completed ack transmission bko2nk bit of uf0en register bko2fl bit of uf0is3 register bkout2 bit of uf0eps0 register bko2dt bit of uf0is3 register 64-byte transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 reading fifo starts reading fifo completed reading fifo starts reading fifo completed f w clear fifo_0 fifo_1 transfer of data less than 64 bytes
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 651 figure 11-5. operation of uf0bo2 register (2/2) (b) operation example 2 sie side cpu side status of uf0bo2 register reception completed transmission starts null reception completed null reception completed fifo toggle fifo toggle ack transmission transmission starts reception completed ack transmission bko2nl bit of uf0is3 register bkout2 bit of uf0eps0 register bko2dt bit of uf0is3 register transfer of data less than 64 bytes 0-byte transfer 0-byte transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 reading fifo starts reading fifo completed f w clear f w clear fifo_0 fifo_1 64-byte transfer
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 652 (8) uf0 bulk out 2 length register (uf0bo2l) the uf0bo2l register stores the length of the data held by the uf0bo2 register. this register is read-only, in 8-bit units. a write access to this register is ignored. the uf0bo2l register always updates the received data length while it is receiving data. if the final transfer is abnormal reception, the uf0bo2l register is cleared to 00h, and an interrupt request is not generated. only if the reception is normal, the interrupt request is generated, and fw can read as much data from the uf0bo2 register as the value read from the uf0bo2l register. the value of the uf0bo2l register is decremented each time the uf0bo2 register has been read. bko2l7 uf0bo2l bko2l6 5 bko2l5 bko2l4 3 bko2l3 2 bko2l2 1 bko2l1 bko2l0 address fffffe87h after reset 00h 0 4 6 7 bit position bit name function 7 to 0 bko2l7 to bko2l0 these bits store the length of the data held by the uf0bo2 register. (9) uf0 bulk in 1 register (uf0bi1) the uf0bi1 register is a 64-byte 2 fifo that stores data for endpoint1. this register consists of two banks of 64-byte fifos each of which performs a toggle operation and repeatedly connects the buses on the sie and cpu sides. the toggle operation takes place when no data is in the fifo on the sie side (counter value = 0) and when the fifo on the cpu side is correctly written (fifo full or bki1ded bit = 1). this register is write-only, in 8-bit units. when this register is read, 00h is read. the hardware transmits data to the usb bus in synchronization with the in token for endpoint1 only when the bki1nk bit of the uf0en register is set to 1 (when nak is not transmitted). the address at which data is to be written or read is managed by the hardware. therefore, fw can transmit data to the host only by writing the data to the uf0bi1 register sequentially. a short packet is transmitted when data is written to the uf0bi1 register and the bki1ded bit of the uf0dend register is set to 1 (bkin1 bit of uf0eps0 register = 1 (data exists)). a null packet is transmitted when the uf0bi1 register is cleared and the bki1ded bit of the uf0dend register is set to 1 (bkin1 bit of the uf0eps0 register = 1 (data exists)). an interrupt request or dma request can be selected by using the dqbi1ms bit of the uf0idr register. bki17 uf0bi1 bki16 5 bki15 bki14 3 bki13 2 bki12 1 bki11 bki10 address fffffe88h after reset undefined 0 4 6 7 bit position bit name function 7 to 0 bki17 to bki10 these bits store data for endpoint1. the operation of the uf0bi1 register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 653 figure 11-6. operation of uf0bi1 register (1/3) (a) operation example 1 sie side cpu side status of uf0bo1 register transmission completed fifo toggle fifo toggle ack reception transmission starts transmission completed ack reception bki1nk bit of uf0en register 64-byte transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 writing fifo starts writing fifo completed writing fifo starts writing fifo completed bki1dt bit of uf0is2 register hardware clear int clear (fw clear) bki1ded bit of uf0dend register is set or hardware set bki1ded bit of uf0dend register is set or hardware set fifo_0 fifo_1 64-byte transfer
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 654 figure 11-6. operation of uf0bi1 register (2/3) (b) operation example 2 sie side cpu side status of uf0bo1 register transmission completed fifo toggle ack reception transmission starts transmission completed ack reception re- transmission starts ack cannot be received bki1nk bit of uf0en register 64-byte transfer re-transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 writing fifo starts writing fifo completed writing fifo starts writing fifo completed bki1dt bit of uf0is2 register hardware clear int clear (fw clear)
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 655 figure 11-6. operation of uf0bi1 register (3/3) (c) operation example 3 sie side cpu side status of uf0bo1 register transmission completed fifo toggle fifo toggle ack reception transmission starts transmission completed ack reception bki1nk bit of uf0en register transfer of null packet short packet transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 fifo clear writing fifo starts writing fifo completed bki1dt bit of uf0is2 register hardware clear int clear (fw clear) bki1ded bit of uf0dend register is set. bki1ded bit of uf0dend register is set. fifo_0 fifo_1
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 656 (10) uf0 bulk in 2 register (uf0bi2) the uf0bi2 register is a 64-byte 2 fifo that stores data for endpoint3. this register consists of two banks of 64-byte fifos each of which performs a toggle operation and repeatedly connects the buses on the sie and cpu sides. the toggle operation takes place when no data is in the fifo on the sie side (counter value = 0) and when the fifo on the cpu side is correctly written (fifo full or bki2ded bit = 1). this register is write-only, in 8-bit units. when this register is read, 00h is read. the hardware transmits data to the usb bus in synchronization with the in token for endpoint3 only when the bki2nk bit of the uf0en register is set to 1 (when nak is not transmitted). the address at which data is to be written or read is managed by the hardware. therefore, fw can transmit data to the host only by writing the data to the uf0bi2 register sequentially. a short packet is transmitted when data is written to the uf0bi2 register and the bki2ded bit of the uf0dend register is set to 1 (bkin2 bit of uf0eps0 register = 1 (data exists)). a null packet is transmitted when the uf0bi2 register is cleared and the bki2ded bit of the uf0dend register is set to 1 (bkin2 bit of the uf0eps0 register = 1 (data exists)). an interrupt request or dma request can be selected by using the dqbi2ms bit of the uf0idr register. bki27 uf0bi2 bki26 5 bki25 bki24 3 bki23 2 bki22 1 bki21 bki20 address fffffe89h after reset undefined 0 4 6 7 bit position bit name function 7 to 0 bki27 to bki20 these bits store data for endpoint3. the operation of the uf0bi2 register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 657 figure 11-7. operation of uf0bi2 register (1/3) (a) operation example 1 sie side cpu side status of uf0bi2 register transmission completed fifo toggle fifo toggle ack reception transmission starts transmission completed ack reception bki2nk bit of uf0en register 64-byte transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 writing fifo starts writing fifo completed writing fifo starts writing fifo completed bki2dt bit of uf0is2 register hardware clear int clear (fw clear) bki2ded bit of uf0dend register is set or hardware set. bki2ded bit of uf0dend register is set or hardware set. fifo_0 fifo_1 64-byte transfer
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 658 figure 11-7. operation of uf0bi2 register (2/3) (b) operation example 2 sie side cpu side status of uf0bi2 register transmission completed fifo toggle ack reception transmission starts transmission completed ack reception re- transmission starts ack cannot be received bki2nk bit of uf0en register 64-byte transfer re-transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 writing fifo starts writing fifo completed writing fifo starts writing fifo completed bki2dt bit of uf0is2 register hardware clear int clear (fw clear)
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 659 figure 11-7. operation of uf0bi2 register (3/3) (c) operation example 3 sie side cpu side status of uf0bi2 register transmission completed fifo toggle fifo toggle ack reception transmission starts transmission completed ack reception bki2nk bit of uf0en register short packet transfer 64-byte transfer fifo_0 fifo_1 fifo_1 fifo_0 fifo clear writing fifo starts writing fifo completed bki2dt bit of uf0is2 register hardware clear int clear (fw clear) bki2ded bit of uf0dend register is set. bki2ded bit of uf0dend register is set. fifo_0 fifo_1 transfer of null packet
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 660 (11) uf0 interrupt 1 register (uf0int1) the uf0int1 register is an 8-byte fifo that stores data for endpoint7 (to be passed to sie). this register is write-only, in 8-bit units. when this register is read, 00h is read. the hardware transmits data to the usb bus in synchronization with the in token for endpoint7 only when the it1nk bit of the uf0en register is set to 1 (when nak is not transmitted). when the data is transmitted and the host correctly receives it, the it1nk bit of the uf0en register is automatically cleared to 0 by hardware. a short packet is transmitted when data is written to the uf0int1 register and the it1dend bit of the uf0dend register is set to 1 (it1 bit of the uf0eps0 register = 1 (data exists)). a null packet is transmitted when the uf0int1 register is cleared and the it1dend bit of the uf0dend register is set to 1 (it1 bit of the uf0eps0 register = 1 (data exists)). it17 uf0int1 it16 5 it15 it14 3 it13 2 it12 1 it11 it10 address fffffe8ah after reset undefined 0 4 6 7 bit position bit name function 7 to 0 it17 to it10 these bits store data for endpoint7. the operation of the uf0int1 register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 661 figure 11-8. operation of uf0int1 register (a) 8-byte transfer status of uf0int1 register transmission starts transmission completed ack reception transmission starts transmission completed re-transmission starts ack reception ack cannot be received it1nk bit of uf0en register it1 bit of uf0eps0 register it1dt bit of uf0is2 register fifo full hardware clear fifo full 8-byte transfer 8-byte transfer re-transfer int clear (fw clear) writing fifo starts writing fifo completed writing fifo starts writing fifo completed counter reloaded (b) when null packet or short packet is transmitted status of uf0int1 register transmission starts transmission completed ack reception transmission starts transmission completed ack reception it1nk bit of uf0en register it1 bit of uf0eps0 register it1dt bit of uf0is2 register hardware clear it1dend bit of uf0dend register is set. it1dend bit of uf0dend register is set. short packet transfer transfer of null packet int clear (fw clear) writing fifo starts writing fifo completed fifo fw clear
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 662 (12) uf0 interrupt 2 register (uf0int2) the uf0int2 register is an 8-byte fifo that stores data for endpoint8 (to be passed to sie). this register is write-only, in 8-bit units. when this register is read, 00h is read. the hardware transmits data to the usb bus in synchronization with the in token for endpoint8 only when the it2nk bit of the uf0en register is set to 1 (when nak is not transmitted). when the data is transmitted and the host correctly receives it, the it2nk bit of the uf0en register is automatically cleared to 0 by hardware. a short packet is transmitted when data is written to the uf0int2 register and the it2dend bit of the uf0dend register is set to 1 (it2 bit of the uf0eps0 register = 1 (data exists)). a null packet is transmitted when the uf0int2 register is cleared and the it2dend bit of the uf0dend register is set to 1 (it2 bit of the uf0eps0 register = 1 (data exists)). it27 uf0int2 it26 5 it25 it24 3 it23 2 it22 1 it21 it20 address fffffe8bh after reset undefined 0 4 6 7 bit position bit name function 7 to 0 it27 to it20 these bits store data for endpoint8. the operation of the uf0int2 register is illustrated below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 663 figure 11-9. operation of uf0int2 register (a) 8-byte transfer status of uf0int2 register transmission starts transmission completed ack reception transmission starts transmission completed re- transmission starts ack reception ack cannot be received it2nk bit of uf0en register it2 bit of uf0eps0 register it2dt bit of uf0is2 register fi fo full hardware clear fi fo full 8-byte transfer re-transfer int clear (fw clear) writing fifo starts writing fifo completed writing fifo starts writing fifo completed counter reloaded 8-byte transfer (b) when null packet or short packet is transmitted status of uf0int2 register transmission starts transmission completed ack reception transmission starts transmission completed ack reception it2nk bit of uf0en register it2 bit of uf0eps0 register it2dt bit of uf0is2 register hardware clear it1dend bit of uf0dend register is set. it1dend bit of uf0dend register is set. short packet transfer transfer of null packet int clear (fw clear) writing fifo starts writing fifo completed fifo fw clear
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 664 11.4.3 request data register area (1) uf0 device status register l (uf0dstl) this register stores the value that is to be returned in response to the get_status device request. this register can be read or written in 8-bit units. the hardware automatically transmits the contents of this register to the host when it has received the get_status device request. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0dstl 0 5 00 3 0 2 0 1 rmwk sfpw address fffffea2h after reset 00h 0 4 6 7 bit position bit name function 1 rmwk this bit specifies whether the remote wakeup function of the device is used. 1: enabled 0: disabled if the device supports a remote wakeup function, this bit is set to 1 by hardware when the set_feature device request has been received, and is cleared to 0 by hardware when the clear_feature device request has been received. if the device does not support a remote wakeup function, make sure that the set_feature device request is not issued from the host. 0 sfpw this bit indicates whether the device is self-powered or bus-powered. 1: self-powered 0: bus-powered
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 665 (2) uf0 ep0 status register l (uf0e0sl) this register stores the value that is to be returned in response to the get_status endpoint0 request. this register can be read or written in 8-bit units. note, however, that data can be written to this register only when the ep0nka bit is set to 1. if an error occurs in usbf, the e0halt bit is set to 1 by fw. a write access to this register is ignored while a usb-side access to endpoint0 is being received. when the e0halt bit is set to 1 by fw, it is not reflected until the next setup token is received if the control transfer immediately before is for the set_feature endpoint0, clear_feature endpoint0, get_status endpoint0 request, or an fw-processed request. the hardware automatically transmits the contents of this register to the host when it has received the get_status endpoint0 request. if endpoint0 has stalled, the uf0e0w and uf0e0r registers are cleared, and the ep0nkw and ep0nkr bits of the uf0e0n register are cleared to 0. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0e0sl 0 5 00 3 0 2 0 1 0 e0halt address fffffea6h after reset 00h 0 4 6 7 bit position bit name function 0 e0halt this bit indicates the status of endpoint0. 1: stalled 0: not stalled this bit is set to 1 by hardware when the set_feature endpoint0 request has been received, and cleared to 0 by hardware when the clear_feature endpoint0 request has been received. data pid is initialized to data0.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 666 (3) uf0 ep1 status register l (uf0e1sl) this register stores the value that is to be returned in response to the get_status endpoint1 request. this register can be read or written in 8-bit units. note, however, that data can be written to this register only when the ep0nka bit is set to 1. if an error occurs in endpoint1, the e1halt bit is set to 1. a write access to this register is ignored while a usb-side access to endpoint1 is being received. the hardware automatically transmits the contents of this register to the host when it has received the get_status endpoint1 request. if endpoint1 has stalled, the uf0bi1 register is cleared and the bki1nk bit is cleared to 0. because writing this register is always masked when transfer to endpoint1, rather than control transfer, is executed, be sure to check this register to see if data has been correctly written to it. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0e1sl 0 5 00 3 0 2 0 1 0 e1halt address fffffea8h after reset 00h 0 4 6 7 bit position bit name function 0 e1halt this bit indicates the status of endpoint1. 1: stalled 0: not stalled this bit is set to 1 by hardware when the set_feature endpoint1 request has been received. it is cleared to 0 by hardware when the clear_feature endpoint1 request, set_configuration request, or the set_interface request for the interface to which endpoint1 is linked has correctly been received. data pid is initialized to data0.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 667 (4) uf0 ep2 status register l (uf0e2sl) this register stores the value that is to be returned in response to the get_status endpoint2 request. this register can be read or written in 8-bit units. note, however, that data can be written to this register only when the ep0nka bit is set to 1. if an error occurs in endpoint2, the e2halt bit is set to 1. a write access to this register is ignored while a usb-side access to endpoint2 is being received. the hardware automatically transmits the contents of this register to the host when it has received the get_status endpoint2 request. if endpoint2 has stalled, the uf0bo1 register is cleared and the bko1nk bit is cleared to 0. because writing this register is always masked when transfer to endpoint2, rather than control transfer, is executed, be sure to check this register to see if data has been correctly written to it. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0e2sl 0 5 00 3 0 2 0 1 0 e2halt address fffffeaah after reset 00h 0 4 6 7 bit position bit name function 0 e2halt this bit indicates the status of endpoint2. 1: stalled 0: not stalled this bit is set to 1 by hardware when the set_feature endpoint2 request has been received. it is cleared to 0 by hardware when the clear_feature endpoint2 request, set_configuration request, or the set_interface request for the interface to which endpoint2 is linked has correctly been received. data pid is initialized to data0.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 668 (5) uf0 ep3 status register l (uf0e3sl) this register stores the value that is to be returned in response to the get_status endpoint3 request. this register can be read or written in 8-bit units. note, however, that data can be written to this register only when the ep0nka bit is set to 1. if an error occurs in endpoint3, the e3halt bit is set to 1. a write access to this register is ignored while a usb-side access to endpoint3 is being received. the hardware automatically transmits the contents of this register to the host when it has received the get_status endpoint3 request. if endpoint3 has stalled, the uf0bi2 register is cleared and the bki2nk bit is cleared to 0. because writing this register is always masked when transfer to endpoint3, rather than control transfer, is executed, be sure to check this register to see if data has been correctly written to it. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0e3sl 0 5 00 3 0 2 0 1 0 e3halt address fffffeach after reset 00h 0 4 6 7 bit position bit name function 0 e3halt this bit indicates the status of endpoint3. 1: stalled 0: not stalled this bit is set to 1 by hardware when the set_feature endpoint3 request has been received. it is cleared to 0 by hardware when the clear_feature endpoint3 request, set_configuration request, or the set_interface request for the interface to which endpoint3 is linked has correctly been received. data pid is initialized to data0.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 669 (6) uf0 ep4 status register l (uf0e4sl) this register stores the value that is to be returned in response to the get_status endpoint4 request. this register can be read or written in 8-bit units. note, however, that data can be written to this register only when the ep0nka bit is set to 1. if an error occurs in endpoint4, the e4halt bit is set to 1. a write access to this register is ignored while a usb-side access to endpoint4 is being received. the hardware automatically transmits the contents of this register to the host when it has received the get_status endpoint4 request. if endpoint4 has stalled, the uf0bo2 register is cleared and the bko2nk bit is cleared to 0. because writing this register is always masked when transfer to endpoint4, rather than control transfer, is executed, be sure to check this register to see if data has been correctly written to it. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0e4sl 0 5 00 3 0 2 0 1 0 e4halt address fffffeaeh after reset 00h 0 4 6 7 bit position bit name function 0 e4halt this bit indicates the status of endpoint4. 1: stalled 0: not stalled this bit is set to 1 by hardware when the set_feature endpoint4 request has been received. it is cleared to 0 by hardware when the clear_feature endpoint4 request, set_configuration request, or the set_interface request for the interface to which endpoint4 is linked has correctly been received. data pid is initialized to data0.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 670 (7) uf0 ep7 status register l (uf0e7sl) this register stores the value that is to be returned in response to the get_status endpoint7 request. this register can be read or written in 8-bit units. note, however, that data can be written to this register only when the ep0nka bit is set to 1. if an error occurs in endpoint7, the e7halt bit is set to 1. a write access to this register is ignored while a usb-side access to endpoint7 is being received. the hardware automatically transmits the contents of this register to the host when it has received the get_status endpoint7 request. if endpoint7 has stalled, the uf0int1 register is cleared and the it1nk bit is cleared to 0. because writing this register is always masked when transfer to endpoint7, rather than control transfer, is executed, be sure to check this register to see if data has been correctly written to it. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0e7sl 0 5 00 3 0 2 0 1 0 e7halt address fffffeb4h after reset 00h 0 4 6 7 bit position bit name function 0 e7halt this bit indicates the status of endpoint7. 1: stalled 0: not stalled this bit is set to 1 by hardware when the set_feature endpoint7 request has been received. it is cleared to 0 by hardware when the clear_feature endpoint7 request, set_configuration request, or the set_interface request for the interface to which endpoint7 is linked has correctly been received. data pid is initialized to data0.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 671 (8) uf0 ep8 status register l (uf0e8sl) this register stores the value that is to be returned in response to the get_status endpoint8 request. this register can be read or written in 8-bit units. note, however, that data can be written to this register only when the ep0nka bit is set to 1. if an error occurs in endpoint8, the e8halt bit is set to 1. a write access to this register is ignored while a usb-side access to endpoint8 is being received. the hardware automatically transmits the contents of this register to the host when it has received the get_status endpoint8 request. if endpoint8 has stalled, the uf0int2 register is cleared and the it2nk bit is cleared to 0. because writing this register is always masked when transfer to endpoint8, rather than control transfer, is executed, be sure to check this register to see if data has been correctly written to it. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0e8sl 0 5 00 3 0 2 0 1 0 e8halt address fffffeb6h after reset 00h 0 4 6 7 bit position bit name function 0 e8halt this bit indicates the status of endpoint8. 1: stalled 0: not stalled this bit is set to 1 by hardware when the set_feature endpoint8 request has been received. it is cleared to 0 by hardware when the clear_feature endpoint8 request, set_configuration request, or the set_interface request for the interface to which endpoint8 is linked has correctly been received. data pid is initialized to data0.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 672 (9) uf0 address register (uf0adrs) this register stores the device address. this register is read-only, in 8-bit units. the device address sent by the set_address request is analyzed and the resultant value is automatically written to this register. if the set_address request is processed by fw, the value of this register is reflected as the device address when the success signal is received in the status stage. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0adrs adrs6 5 adrs5 adrs4 3 adrs3 2 adrs2 1 adrs1 adrs0 address fffffec0h after reset 00h 0 4 6 7 bit position bit name function 6 to 0 adrs6 to adrs0 these bits hold the device address of sie.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 673 (10) uf0 configuration register (uf0cnf) this register stores the value that is to be returned in response to the get_configuration request. this register is read-only, in 8-bit units. when the set_configuration request is received, its wvalue is automatically written to this register. to change the value of this register by fw after a value other than 00h has been written to the register, write 00h once and then write the desired value. when a change of the value of this register from 00h to other than 00h is detected, the conf bits are set to 1. if the set_configuration request is processed by fw, the status of this register is immediately reflected on the uf0mods register as soon as data has been written to this register (conf bits = 1 before completion of the status stage). caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0cnf 0 5 00 3 0 2 0 1 conf1 conf0 address fffffec1h after reset 00h 0 4 6 7 bit position bit name function 1, 0 conf1, conf0 these bits hold the data to be returned in response to the get_configuration request.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 674 (11) uf0 interface 0 register (uf0if0) this register stores the value that is to be returned in response to the get_interface windex = 0 request. this register is read-only, in 8-bit units. when the set_interface request is received, its wvalue is automatically written to this register. if the set_interface request is processed by fw, windex and wvalue are decoded, and the setting of endpoint is automatically changed. at this time, the status bit of the target endpoint and dpid are automatically cleared to 0, depending on the setting. the fifo is not cleared automatically. caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 uf0if0 0 5 00 3 0 2 if02 1 if01 if00 address fffffec2h after reset 00h 0 4 6 7 bit position bit name function 2 to 0 if02 to if00 these bits hold the data to be returned in response to get_interface windex = 0 request.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 675 (12) uf0 interface 1 to 4 registers (uf0if1 to uf0if4) these registers store the value that is to be returned in response to the get_interface windex = n request (n = 1 to 4). these registers are read-only, in 8-bit units. when the set_interface request is received, its wvalue is automatically written to these registers. these registers are invalidated according to the setting of the uf0aifn and uf0aas registers. if the set_interface request is processed by fw, windex and wvalue are decoded, and the setting of endpoint is automatically changed. at this time, the status bit of the target endpoint and dpid are automatically cleared to 0, depending on the setting. the fifo is not cleared automatically. caution to rewrite these registers, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 0 0 0 0 uf0if1 uf0if2 uf0if3 uf0if4 0 0 0 0 5 0 0 0 0 0 0 0 0 3 0 0 0 0 2 if12 if22 if32 if42 1 if11 if21 if31 if41 if10 if20 if30 if40 address fffffec3h fffffec4h fffffec5h fffffec6h after reset 00h 00h 00h 00h 0 4 6 7 bit position bit name function 2 to 0 ifn2 to ifn0 these bits hold the data to be returned in response to get_interface windex = n request. remark n = 1 to 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 676 (13) uf0 descriptor length register (uf0dscl) this register stores the length of the value that is to be returned in response to the get_descriptor configuration request. the value of this register is the number of bytes of all the descriptors set by the uf0cien register minus 1 (n = 0 to 255). the total descriptor length that is to be returned in response to the get_descriptor configuration request is determined according to the value of this register. this register can be read or written in 8-bit units. however, data can be written to this register only when the ep0nka bit is set to 1. processing of wlength is automatically controlled. if this register is set to 00h, it means that the descriptor to be returned is 1 byte long. if the register is set to ffh, a descriptor length of 256 bytes is returned. when a descriptor exceeding 256 bytes in length is used, set the cdcgdst bit of the uf0modc register to 1 and process the get_descriptor request by fw (at this time, the cdcgd bit of the uf0mods register is also set to 1). caution to rewrite this register, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. dpl7 uf0dscl dpl6 5 dpl5 dpl4 3 dpl3 2 dpl2 1 dpl1 dpl0 address fffffed0h after reset 00h 0 4 6 7 bit position bit name function 7 to 0 dpl7 to dpl0 these bits set the value of the number of bytes of all the descriptors to be returned in response to the get_descriptor configuration request minus 1.
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 677 (14) uf0 device descriptor registers 0 to 17 (uf0dd0 to uf0dd17) these registers store the value to be returned in response to the get_descriptor device request. these registers can be read or written in 8-bit units. however, data can be written to these registers only when the ep0nka bit is set to 1. cautions 1. to rewrite these registers, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 2. use the value defined by usb specification ver. 2.0 and the latest class specification as the set value. uf0ddn (n = 0 to 17) 5 3 2 1 after reset 0 4 6 7 undefined address see table 11-4 . table 11-4. mapping and data of uf0 device descriptor registers symbol address field name contents uf0dd0 fffffed1h blength size of this descriptor uf0dd1 fffffed2h bdescriptortype device descriptor type uf0dd2 fffffed3h value below decimal point of rev. number of usb specification uf0dd3 fffffed4h bcdusb value above decimal point of rev. number of usb specification uf0dd4 fffffed5h bdeviceclass class code uf0dd5 fffffed6h bdevicesubclass subclass code uf0dd6 fffffed7h bdeviceprotocol protocol code uf0dd7 fffffed8h bmaxpacketsize0 maximum packet size of endpoint0 uf0dd8 fffffed9h lower value of vendor id uf0dd9 fffffedah idvendor higher value of vendor id uf0dd10 fffffedbh lower value of product id uf0dd11 fffffedch idproduct higher value of product id uf0dd12 fffffeddh lower value of device release number uf0dd13 fffffedeh bcddevice higher value of device release number uf0dd14 fffffedfh imanufacturer index of string descriptor describing manufacturer uf0dd15 fffffee0h iproduct index of string descriptor describing product uf0dd16 fffffee1h lserialnumber index of string descriptor describing device serial number uf0dd17 fffffee2h bnumconfigurations number of settable configurations
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 678 (15) uf0 configuration/interface/endpoint descriptor registers 0 to 255 (uf0cie0 to uf0cie255) these registers store the value to be returned in response to the get_descriptor configuration request. these registers can be read or written in 8-bit units. however, data can be written to these registers only when the ep0nka bit is set to 1. descriptor information of up to 256 bytes can be stored in these registers. store each descriptor in the order of configuration, interface, and endpoint (see table 11-5 ). if there are two or more interfaces, repeatedly store the data following the interface descriptor. table 11-5. mapping of uf0cien register address descriptor stored fffffee3h configuration descriptor (9 bytes) fffffeech interface descriptor (9 bytes) fffffef5h endpoint1 descriptor (7 bytes) fffffefch endpoint2 descriptor (7 bytes) ffffff03h endpoint3 descriptor (7 bytes) :: ffffffxxh interface descriptor (9 bytes) ffffffxxh+9 endpoint1 descriptor (7 bytes) ffffffxxh+16 endpoint2 descriptor (7 bytes) ffffffxxh+23 endpoint3 descriptor (7 bytes) :: the range of the valid data that can be set to these registers varies according to the setting of the uf0dscl register. in addition to the descriptors listed in table 11-6, descriptors peculiar to classes and vendors can also be stored. if all the values are fixed, they can be stored in rom. cautions 1. to rewrite these registers, set the ep0nka bit to 1 before reading the register contents, and rewrite the register contents after confirming that the bit has been set, in order to prevent conflict between a read access and a write access. 2. use the value defined by usb specification ver. 2.0 and the latest class specification as the set value. uf0cien (n = 0 to 255) 5 3 2 1 after reset 0 4 6 7 fffffee3h to ffffffe2h undefined address
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 679 table 11-6. data of uf0cien register (a) configuration descriptor (9 bytes) offset field name contents 0 blength size of this descriptor 1 bdescriptortype descriptor type 2 lower value of the total number of bytes of configuration, all interface, and all endpoint descriptors 3 wtotallength higher value of the total number of bytes of configuration, all interface, and all endpoint descriptors 4 bnuminterface number of interfaces 5 bconfigurationvalue value to select this configuration 6 iconfiguration index of string descriptor describing this configuration 7 bmattributes features of this configuration (self-powered, without remote wakeup) 8 maxpower maximum power consumption of this configuration (unit: ma) (b) interface descriptor (9 bytes) offset field name contents 0 blength size of this descriptor 1 bdescriptortype descriptor type 2 binterfacenumber value of this interface 3 balternatesetting value to select alternative setting of interface 4 bnumendpoints number of usable endpoints 5 binterfaceclass class code 6 binterfacesubclass subclass code 7 binterfaceprotocol protocol code 8 interface index of string descriptor describing this interface (c) endpoint descriptor (7 bytes) offset field name contents 0 blength size of this descriptor 1 bdescriptortype descriptor type 2 bendpointaddress address/transfer direction of this endpoint 3 bmattributes transfer type 4 lower value of maximum number of transfer data 5 wmaxpaketsize higher value of maximum number of transfer data 6 binterval transfer interval
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 680 11.4.4 peripheral control registers (1) usb function 0 dma channel select register (uf0cs) this register allocates each dma service of the usb function to a dma channel. this register can be read or written in 16-bit units. to allocate the service of a usb function to a dma channel by using this register, set this register in advance, set the dtfrn register (n = 0 to 3) of the dma controller to 7fh, and enable usb_dma in advance. caution setting the same dma service to different dma channels and setting different dma services to the same dma channel are prohibited. 14 ufd c32 13 ufd c31 12 ufd c30 2 ufd c02 3 0 4 ufd c10 5 ufd c11 6 ufd c12 7 0 8 ufd c20 9 ufd c21 10 ufd c22 11 0 15 0 1 ufd c01 0 ufd c00 uf0cs fffffdf0h, fffffdf1h after reset 0000h address bit position bit name function these bits set the dma service of a usb function to be allocated to dma channel n. ufdcn2 ufdcn1 ufdcn0 service to be allocated 1 1 1 ep4_dma 1 1 0 ep3_dma 1 0 1 ep2_dma 1 0 0 ep1_dma 0 x x no allocation (dma not used) 14 to 12, 10 to 8, 6 to 4, 2 to 0 ufdcn2 to ufdcn0 remark x: don ? t care remark n = 0 to 3
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 681 (2) usb function 0 buffer control register (uf0bc) this register performs enable control and floating control on the input buffer of the usb function. this register can be read or written in 8-bit or 1-bit units. 0 uf0bc 0 5 00 3 0 2 0 1 ubfien ubfior address fffffedf2h after reset 00h 0 4 6 7 bit position bit name function 1 ubfien this bit controls use of the usb buffer. 1: buffer valid 0: buffer invalid caution clear this bit to 0 when the usb is not used. if this bit is set to 1, a current of 3 ma (typ.) constantly flows, regardless of whether the usb is used or not. 0 ubfior this bit controls use of floating measures of the usb buffer. 1: disables floating measures 0: enables floating measures this bit prevents erroneous recognition of bus reset, suspend, and resume due to an undefined value when a cable is not connected (when data input is floated). when this bit is set to 1, control the processing for floating by the vbus signal (which recognizes cable connection).
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 682 11.5 stall handshake or no handshake errors of usbf are defined to be handled as follows. transfer type transaction target packet error type function response processing endpoint not supported no response none endpoint transfer direction mismatch no response none crc error no response none control transfer/ bulk transfer/ interrupt transfer in/out/setup token bit stuffing error no response none timeout no response none pid check error no response none unsupported pid (other than data pid) no response none crc error no response discard received data out/setup data bit stuffing error no response discard received data control transfer/ bulk transfer out data data pid mismatch ack discard received data control transfer (setup stage) setup data overrun no response discard received data control transfer (data stage) out data overrun no response note 1 set sndstl bit of uf0sds register to 1 and discard received data control transfer (status stage) out data overrun ack or no response note 2 set sndstl bit of uf0sds register to 1 and discard received data bulk transfer out data overrun no response note 1 set enhalt bit of uf0ensl register (n = 0 to 4, 7, 8) to 1 pid check error ? hold transferred data and re-transfer data note 3 unsupported pid (other than ack pid) ? hold transferred data and re-transfer data note 3 control transfer/ bulk transfer/ interrupt transfer in handshake timeout ? hold transferred data and re-transfer data note 3 notes 1. a stall response is made to re-transfer by the host. 2. an ack response is made if the transfer data is of less than maxpacketsize and the data received in the status stage is discarded. if maxpacketsize is exceeded, no response is made, the sndstl bit of the uf0sds register is set to 1, and the received data is discarded. 3. if an out transaction indicating a change from the data stage to the status stage is received during control transfer, an error is not handled and it is assumed that reception has been correctly completed. cautions 1. it is judged by the alternative setting number currently set whether the target endpoint is valid or invalid. 2. for the response to the request included in control transfer to/from endpoint0, see 11.3 requests.
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 683 11.6 register values in specific status table 11-7. register values in specific status (1/2) register name after cpu reset (reset) after bus reset uf0e0n register 00h value is held. uf0e0na register 00h value is held. uf0en register 00h value is held. uf0enm register 00h value is held. uf0sds register 00h value is held. uf0clr register 00h value is held. uf0set register 00h value is held. uf0eps0 register 00h value is held. uf0eps1 register 00h value is held. uf0eps2 register 00h value is held. uf0is0 register 00h value is held. uf0is1 register 00h value is held. uf0is2 register 00h value is held. uf0is3 register 00h value is held. uf0is4 register 00h value is held. uf0im0 register 00h value is held. uf0im1 register 00h value is held. uf0im2 register 00h value is held. uf0im3 register 00h value is held. uf0im4 register 00h value is held. uf0ic0 register ffh value is held. uf0ic1 register ffh value is held. uf0ic2 register ffh value is held. uf0ic3 register ffh value is held. uf0ic4 register ffh value is held. uf0idr register 00h value is held. uf0dms0 register 00h value is held. uf0dms1 register 00h value is held. uf0fic0 register 00h value is held. uf0fic1 register 00h value is held. uf0dend register 00h value is held. uf0gpr register 00h value is held. uf0modc register 00h value is held. uf0mods register 00h bit 2 (conf): cleared (0), other bits: value is held. uf0aifn register 00h value is held. uf0aas register 00h value is held. uf0ass register 00h 00h uf0e1im register 00h value is held. uf0e2im register 00h value is held.
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 684 table 11-7. register values in specific status (2/2) register name after cpu reset (reset) after bus reset uf0e3im register 00h value is held. uf0e4im register 00h value is held. uf0e7im register 00h value is held. uf0e8im register 00h value is held. uf0e0r register undefined note 1 value is held. uf0e0l register 00h value is held. uf0e0st register 00h 00h uf0e0w register undefined note 1 value is held. uf0bo1 register undefined note 1 value is held. uf0bo1l register 00h value is held. uf0bo2 register undefined note 1 value is held. uf0bo2l register 00h value is held. uf0bi1 register undefined note 1 value is held. uf0bi2 register undefined note 1 value is held. uf0int1 register undefined value is held. uf0int2 register undefined value is held. uf0dstl register 00h 00h uf0e0sl register 00h 00h uf0e1sl register 00h 00h uf0e2sl register 00h 00h uf0e3sl register 00h 00h uf0e4sl register 00h 00h uf0e7sl register 00h 00h uf0e8sl register 00h 00h uf0adrs register 00h 00h uf0cnf register 00h 00h uf0if0 register 00h 00h uf0if1 register 00h 00h uf0if2 register 00h 00h uf0if3 register 00h 00h uf0if4 register 00h 00h uf0dscl register 00h value is held. uf0ddn register (n = 0 to 17) note 2 note 2 uf0cien register (n = 0 to 255) note 2 note 2 notes 1. this register can be cleared to 0 by the reset signal because its write pointer, counter, and read pointer are cleared to 0 when the reset signal becomes active, in the same manner as clearing by the uf0ficn register, as the register is controlled by fifo. 2. this register cannot be cleared to 0. because data can be written to it by fw, however, any value can be written to the register (before doing so, however, be sure to set the ep0nka bit of the uf0e0na register to 1).
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 685 11.7 fw processing the following fw processing is performed. ? setting processing on device side for the set_configuration, set_interface, set_feature, and clear_feature requests during enumeration processing ? analysis and processing of xxxxstandard, xxxxclass, and xxxxvendor requests not subject to automatic processing ? reading data following bulk-transferred out token from receive buffer ? writing data to be returned in response to bulk-transferred in token ? writing data to be returned in response to interrupt-transferred token the following table lists the requests supported by fw.
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 686 table 11-8. fw-supported standard requests request reception side processing/ frequency explanation clear_feature interface automatic stall response it is considered that this request does not come to interface because there is no function selector value, though it is reserved for bmrequesttype. when this request is received, the hardware makes an automatic stall response. set_feature interface automatic stall response it is considered that this request does not come to interface because there is no function selector value, though it is reserved for bmrequesttype. when this request is received, the hardware makes an automatic stall response. get_descriptor string fw returns the string descriptor. when this request is received by the setup token, the hardware generates the cpudec interrupt request for fw. fw decodes the contents of the request from the cpudec interrupt request, and writes the data to be returned to the host, to the uf0e0w register. set_descriptor device fw rewrites the device descriptor. when this request is received by the setup token, the hardware generates the cpudec interrupt request for fw. fw decodes the contents of the request from the cpudec interrupt request, and the writes the data for the next control transfer (out) to the uf0ddn register (n = 0 to 17). set_descriptor configuration fw rewrites the configuration descriptor. when this request is received by the setup token, the hardware generates the cpudec interrupt request for fw. fw decodes the contents of the request from the cpudec interrupt request, and the writes the data for the next control transfer (out) to the uf0cien register (n = 0 to 255). set_descriptor string fw rewrites the string descriptor. when this request is received by the setup token, the hardware generates the cpudec interrupt request for fw. fw decodes the contents of the request from the cpudec interrupt request, and loads the data for the next control transfer (out). other na fw when this request is received by the setup token, the hardware generates the cpudec interrupt request for fw. fw decodes the contents of the request from the cpudec interrupt request, and performs the necessary processing.
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 687 11.7.1 initialization processing initialization processing is executed in the following two ways. ? initialization of request data register area ? setting of interrupt when the request data register area is initialized, data for the get_xxxx request to which a value is to be automatically returned is written and an endpoint is allocated to an interface. in the interrupt settings, the interrupt sources that do not have to be checked can be masked by using the uf0imn register (n = 0 to 4). the following flowcharts illustrate the above processing. figure 11-10. initializing request data register area start end ep0nka = 1? (uf0e0na) cancels nak response to endpoint0. uf0e0na register = 01h initialization of request data register area uf0modc register = 40h or 00h yes no : see figure 11-11 initialization of request data register area . setting of interface and endpoint uf0e0na register = 00h : see figure 11-12 setting of interface and endpoint . if the total number of bytes of the uf0cien register exceeds 256, set the uf0modc register to 40h. no data has to be written to the uf0cien register. remark n = 0 to 255
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 688 figure 11-11. initialization of request data register area the value of 0xh depends on the power supply method. ? sfpw = 1: self-powered ? sfpw = 0: bus-powered n = 0 to 4, 7, or 8. setting is unnecessary if the target endpoint is not used. if the total number of bytes of the uf0ciea register exceeds 256, set the uf0modc register to 40h. no data has to be written to the uf0ciea register. input the total number of bytes of the uf0ciea register. uf0dstl register = 0xh uf0ensl register = 00h setting of uf0dscl register inputting uf0ddm register inputting uf0ciea register remark m = 0 to 17 a = 0 to 255 figure 11-12. setting of interface and endpoint addif, ifno1, ifno2 = 000: interface number 0 is valid. addif, ifno1, ifno2 = 100: interface numbers 0 and 1 are valid. addif, ifno1, ifno2 = 101: interface numbers 0 to 2 are valid. addif, ifno1, ifno2 = 110: interface numbers 0 to 3 are valid. addif, ifno1, ifno2 = 111: interface numbers 0 to 4 are valid. set a link between the target interface of endpoint n and alternative setting. set 00h if the target endpoint is not used. set interface number(s) and a link with the 5- or 2-series alternative setting. setting of uf0aifn register setting of uf0aas register setting of uf0enim register remark n = 1 to 4, 7, 8
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 689 figure 11-13. setting of interrupt start end mask the interrupt source to avoid issuance of an unnecessary interrupt request (intusbmb). setting of uf0imn register remark n = 0 to 4 m = 0 where n = 0, 1 m = 1 where n = 2, 3 m = 2 where n = 4
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 690 11.7.2 interrupt servicing the following flowchart illustrates how an interrupt is serviced. figure 11-14. interrupt servicing start end intusb2b = 0? intusb0b = 0? intusbab active yes yes (n = 0, 1) (a = 0 to 2) (m = 2, 3) no no reading uf0is4 register setintc of uf0ic4 register = 0 reading uf0isn register target bit of uf0icn register = 0 reading uf0ism register target bit of uf0icm register = 0 servicing interrupt masking id bit remark ? : processing by hardware the following bits of the uf0isn register are automatically cleared by hardware when a given condition is satisfied (n = 1 to 4). ? e0indt, e0odt, suces, stg, and cpudec bits of uf0is1 register ? bki2dt, bki1dt, it2dt, and it1dt bits of uf0is2 register ? bko2fl, bko2dt, bko1fl, and bko1dt bits of uf0is3 register because clearing an interrupt source by the uf0icn register is given a lower priority than setting an interrupt source by hardware, the interrupt source may not be cleared depending on the timing (n = 0 to 4).
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 691 11.7.3 usb main processing usb main processing involves processing usb transactions. the types of transactions to be processed are as follows. ? fully automatically processed request for control transfer ? automatically processed requests for control transfer (set_configuration, set_interface, set_feature, clear_feature) ? cpudec request for control transfer ? processing for bulk transfer (in) ? processing for bulk transfer (out) ? processing for interrupt transfer (in) processing for endpoint n involves writing or reading for data transfer. the flowchart shown below is for pio. (1) fully automatically processed request for control transfer because the fully automatically processed request for control transfer is executed by hardware, it cannot be referenced by fw. therefore, fw does not have to perform any special processing for this request. (2) automatically processed requests for control transfer (set_configuration, set_interface, set_feature, clear_feature) processing to write a register for automatically processed requests for control transfer, such as set_configuration, set_interface, set_feature, and clear_feature requests, is automatically executed by hardware, but an interrupt request is issued for recognition on the device side. this processing may be ignored if there is no special processing to be executed. the flowcharts are shown below.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 692 figure 11-15. automatically processed requests for control transfer start end clear_feature? set_feature? receiving setup token clear_featur e processing set_feature processing set_configuration? set_configuration processing set_interface? set_interface processing intusb0b/intusb2b active decoding request (n = 0, 1) yes no yes no yes no yes no other automatically processed request? cpudec processing illegal processing illegal processing yes no intusb2b = 1? reading uf0isn register reading uf0is4 register reading uf0set register fw processing for each request yes yes no no clrrq = 1? (uf0is0) setrq = 1? (uf0is0) reading uf0clr register fw processing for each request yes no yes no setint = 1? (uf0is4) end end end automatic processing end setintc = 0 (uf0ic4) fw processing for set_interface : see figure 11-16 clear_feature processing . : see figure 11-17 set_feature processing . : see figure 11-18 set_configuration processing . : see figure 11-19 set_interface processing . remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 693 figure 11-16. clear_feature processing set the corresponding bit for the value of 0xh. the ephalt bit of the uf0is0 register is cleared to 0 only when all halt features are cleared. uf0clr register = 0xh clrrq = 1 (uf0is0) haltn = 0 (uf0eps2) clearing uf0dstl register clearing uf0ensl register remarks 1. n = 0 to 4, 7, 8 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 694 figure 11-17. set_feature processing set the corresponding bit for the value of 0xh. the ephalt bit of the uf0is0 register is not set to 1 by setting the uf0dstl register. uf0set register = 0xh setrq = 1 (uf0is0) haltn = 1 (uf0eps2) ephalt = 1 (uf0is0) setting uf0dstl register setting uf0ensl register remarks 1. n = 0 to 4, 7, 8 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 695 figure 11-18. set_configuration processing setcon = 1 (uf0set) setrq = 1 (uf0is0) conf = 1 (uf0mods) setting uf0cnf register remark ? : processing by hardware figure 11-19. set_interface processing setint = 1 (uf0is4) setting uf0ass register setting uf0ifn register remarks 1. n = 0 to 4 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 696 (3) cpudec request for control transfer the cpudec request can be classified into three types of processing: control transfer (write), control transfer (read), and control transfer (without data). control transfer (write) indicates a request that uses the out transaction in the data stage (e.g., set_descriptor), and control transfer (read) indicates a request that uses the in transaction in the data stage (e.g., get_descriptor). control transfer (without data) indicates a request that has no data stage (e.g., set_configuration). the flowcharts are shown below. figure 11-20. cpudec request for control transfer (1/12) (a) token phase (1/2) start cpudec = 1? (uf0is1) intusb0b active appropriate interrupt servicing cpudec = 0 (uf0is1) reading uf0isn register protc = 0 (uf0ic1) stgm = 0 (uf0im1) cpudecm = 1 (uf0im1) reading uf0e0st register 8 times decoding fw request yes no g e a remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 697 figure 11-20. cpudec request for control transfer (2/12) (a) token phase (2/2) supported request? prot = 1? (uf0is1) control transfer (read)? control transfer (write)? reading uf0isn register sndstl = 1 (uf0sds) sndstl = 0 (uf0sds) ep0rc = 1 (uf0fic0) stgm = 1 (uf0im1) cpudecm = 0 (uf0im1) b yes no yes no yes no yes no setup token received? yes no stall handshake response end e c d a in the case of an unsupported request for control transfer (write), clear the fifo because data may be written to the fifo as a result of out transfer before the stall response is made. it is judged whether the request decoded by the device is supported. request that uses control transfer (in), such as get_descriptor string request that uses control transfer (out), such as set_descriptor string remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 698 figure 11-20. cpudec request for control transfer (3/12) (b) control transfer (read) (1/4) in token received? e0in = 1? (uf0is1) transmitting nak e0in = 1 (uf0is1) writing uf0e0w register e0inm = 1 (uf0im1) yes no yes no b if return data greater than the fifo size exists, it is divided into fifo size units and sequentially written, starting from the lowest data byte. intusb0b active reading uf0isn register i f illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user?s manual u16031ej2v1ud 699 figure 11-20. cpudec request for control transfer (4/12) (b) control transfer (read) (2/4) fifo full? e0ded = 1 (uf0dend) ep0nkw = 1 (uf0e0n) transmitting data of uf0e0w register yes no in token received? yes no prot = 1? (uf0is1) no yes g h ack received? yes no ep0wc = 1 (uf0fic0) f remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 700 figure 11-20. cpudec request for control transfer (5/12) (b) control transfer (read) (3/4) i j no transmit data? e0indt = 1 (uf0is1) ep0nkw = 0 (uf0e0n) e0indtc = 0 (uf0ic1) stg = 1 (uf0is1) yes yes no h intusb0b active reading uf0isn register e0indt = 1? (uf0is1) no yes data of null packet received? no illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 701 figure 11-20. cpudec request for control transfer (6/12) (b) control transfer (read) (4/4) intusb0b active reading uf0isn register reading uf0isn register transmitting ack intusb0b active cpudecm = 0 (uf0im1) e0inm = 0 (uf0im1) yes stg = 1? (uf0is1) no yes suces = 1? (uf0is1) no stgm = 1 (uf0im1) suces = 1 (uf0is1) sucesc = 0 (uf0ic1) e0inc = 0 (uf0ic1) end j illegal processing illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 702 figure 11-20. cpudec request for control transfer (7/12) (c) control transfer (write) (1/4) clearing uf0e0r register c k g intusb0b active yes normal reception? no ep0rc = 1 (uf0fic0) no prot = 1? (uf0is1) yes yes out token received? no writing uf0e0r register e0odt = 1 (uf0is1) ep0r = 1 (uf0eps0) ep0nkr = 1 (uf0e0n) reading uf0isn register remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 703 figure 11-20. cpudec request for control transfer (8/12) (c) control transfer (write) (2/4) c out token received? no yes l e0odt = 0 (uf0is1) ep0r = 0 (uf0eps0) ep0nkr = 0 (uf0e0n) yes in token received? no yes e0odt = 1? (uf0is1) no reading uf0e0r register data length = data length ? 1 no data length other than 0? yes updating data length of uf0e0l register updating data length of uf0e0l register uf0e0l register data is read up to the value read by the uf0e0r register. k illegal processing remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 704 figure 11-20. cpudec request for control transfer (9/12) (c) control transfer (write) (3/4) l intusb0b active yes stg = 1? (uf0is1) no stg = 1 (uf0is1) e0in = 1 (uf0is1) reading uf0isn register g clearing read data no prot = 1? (uf0is1) yes request processing ep0wc = 1 (uf0fic0) e0ded = 1 (uf0dend) m illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 705 figure 11-20. cpudec request for control transfer (10/12) (c) control transfer (write) (4/4) yes yes in token received? no yes suces = 1? (uf0is1) no intusb0b active transmitting data of null packet reading uf0isn register suces = 1 (uf0is1) e0indt = 1 (uf0is1) sucesc = 0 (uf0ic1) e0indtc = 0 (uf0ic1) cpudecm = 0 (uf0im1) stgm = 1 (uf0im1) e0inm = 1 (uf0im1) ack received? no end m illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 706 figure 11-20. cpudec request for control transfer (11/12) (d) control transfer (without data stage) (1/2) d yes stg = 1? (uf0is1) no yes in token received? no e0ded = 1 (uf0dend) e0in = 1 (uf0is1) stg = 1 (uf0is1) intusb0b active reading uf0isn register ep0wc = 1 (uf0fic0) g request processing aborted no prot = 1? (uf0is1) yes in token of status phase n illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 707 figure 11-20. cpudec request for control transfer (12/12) (d) control transfer (without data stage) (2/2) yes yes in token received? no yes suces = 1? (uf0is1) no intusb0b active transmitting data of null packet reading uf0isn register suces = 1 (uf0is1) e0indt = 1 (uf0is1) sucesc = 0 (uf0ic1) e0inc = 0 (uf0ic1) e0indtc = 0 (uf0ic1) e0inm = 1 (uf0im1) cpudecm = 0 (uf0im1) e0inm = 1 (uf0im1) stgm = 1 (uf0im1) ack received? no end request processing n illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 708 (4) processing for bulk transfer (in) bulk transfer (in) is allocated to endpoint1 and endpoint3. the flowchart shown below illustrates how endpoint1 is controlled. endpoint3 can also be controlled in the same sequence. to use this flowchart as the control flow of endpoint3, therefore, read the bit names of endpoint1 in the flowchart as those of endpoint3.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 709 figure 11-21. processing for bulk transfer (in) (endpoint1) yes bki1in = 1? (uf0is2) no yes bki1dt = 1? (uf0is2) no yes no transmit data? no yes in token received? no parallel processing by hardware end end start bki1in = 1 (uf0is2) returning nak intusb1b active bki1ded = 1 (uf0dend) no yes bki1cc = 1 (uf0fic0) intusb1b active reading uf0isn register bki1inc = 0 (uf0ic2) bki1dtc = 0 (uf0ic2) data error? reading uf0isn register writing uf0bi1 register bki1nk = 1 (uf0en) bki1dt = 1 (uf0is2) bki1inm = 1 (uf0im2) if return data greater than the fifo size exists, it is divided into fifo size units and sequentially written, starting from the lowest data byte. the timing of the bit value varies depending on the situation on the sie side. illegal processing illegal processing : see figure 11-22 parallel processing by hardware . remarks 1. n = 2, 3 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 710 figure 11-22. parallel processing by hardware yes yes in token received? no transmitting data of uf0bi1 register ack received? no yes no transmit data? no bki1nk = 0 (uf0en) remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 711 (5) processing for bulk transfer (out) bulk transfer (out) is allocated to endpoint2 and endpoint4. the flowchart shown below illustrates how endpoint2 is controlled. endpoint4 can also be controlled in the same sequence. to use this flowchart as the control flow of endpoint4, therefore, read the bit names of endpoint2 in the flowchart as those of endpoint4.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 712 figure 11-23. normal processing for bulk transfer (out) (endpoint2) yes out token received? no yes bko1dt = 1? (uf0is3) no yes data length = 0? no no out token received? yes end start writing uf0bo1 register bko1dt = 1 (uf0is3) bkout1 = 1 (uf0eps0) clearing uf0bo1 register yes no normal reception? intusb1b active reading uf0isn register bko1dt = 0 (uf0is3) bkout1 = 0 (uf0eps0) updating data length of uf0bo1l register reading uf0bo1 register data length = data length ? 1 updating data length of uf0bo1 register no data length other than 0? yes uf0bo1 register data is read up to the value read by the uf0bo1l register. illegal processing illegal processing remarks 1. n = 2, 3 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 713 during bulk transfer (out), more data may be transmitted from the host than expected by the system. endpoint2 and endpoint4 for bulk transfer (out) of the v850e/me2 consist of two 64-byte buffers so that nak responses are suppressed as much as possible and data can be read from the cpu side even while the bus side is being accessed as the transfer rate of the usb bus increases. consequently, if the host sends more data than expected by the system, up to 128 bytes of extra data may be automatically received in the worst case. in this case, change the control flow from that of the normal processing of endpoint2 and endpoint4 to the flow illustrated below when the quantity of data expected by the system has decreased to two packets. this flowchart illustrates how endpoint2 is controlled. endpoint4 can also be controlled in the same sequence. to use this flowchart as the control flow of endpoint4, therefore, read the bit names of endpoint2 in the flowchart as those of endpoint4.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 714 figure 11-24. processing if more data than expected by system is transmitted (endpoint2) (1/2) yes out token received? no yes out token received? no yes bko1fl = 1? (uf0is3) no start writing uf0bo1 register bko1dt = 1 (uf0is3) bkout1 = 1 (uf0eps0) intusb1b active clearing uf0bo1 register yes normal reception? no writing uf0bo1 register reading uf0isn register bko1nkm = 1 (uf0enm) bko1fl = 1 (uf0is3) bko1nk = 1 (uf0en) clearing uf0bo1 register yes normal reception? no i updating data length of uf0bo1l register bko1nk = 1 (uf0en) illegal processing remarks 1. n = 2, 3 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 715 figure 11-24. processing if more data than expected by system is transmitted (endpoint2) (2/2) yes out token received? no yes next system sequence? no bko1nak = 1 (uf0is3) nak response intusb1b active bko1nkm = 0 (uf0enm) bko1nk = 0 (uf0en) expected system sequence processing expected processing such as endpoint stall bko1nkm = 0 (uf0enm) bko1nk = 0 (uf0en) bko1nakc = 0 (uf0ic3) yes bko1nak = 1? (uf0is3) no end end reading uf0bo1 register bko1fl = 0 (uf0is3) reading uf0bo1 register data length = data length ? 1 no data length other than 0? yes uf0bo1 register data is read up to the value read by the uf0bo1l register. uf0bo1 register data is read up to the value read by the uf0bo1l register. updating data length of uf0bo1l register bko1dt= 0 (uf0is3) bkout1 = 0 (uf0eps0) data length = data length ? 1 no data length other than 0? yes i illegal processing remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 716 (6) processing for interrupt transfer (in) interrupt transfer (in) is allocated to endpoint7 and endpoint8. the flowchart shown below illustrates how endpoint7 is controlled. endpoint8 can also be controlled in the same sequence. to use this flowchart as the control flow of endpoint8, therefore, read the bit names of endpoint7 in the flowchart as those of endpoint8.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 717 figure 11-25. processing for interrupt transfer (in) (endpoint7) reading uf0eps0 register writing uf0int1 register transmitting data of uf0int1 register it1nk = 1 (uf0en) fif o full? no no data error? yes it1dend = 1 (uf0dend) itr1c = 1 (uf0fic0) yes in token received? no yes it1dt = 1? (uf0is2) no yes ac k received? no yes yes it1 = 0? (uf0eps0) no end start it1dt = 1 (uf0is2) it1 = 0 (uf0eps0) it1nk = 0 (uf0en) intusb1b active reading uf0isn register it1dtc = 0 (uf0ic2) yes no transmit data? no illegal processing remarks 1. n = 2, 3 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 718 11.7.4 suspend/resume processing how suspend/resume processing is performed differs depending on the configuration of the system. one example is given below. figure 11-26. example of suspend/resume processing (1/3) (a) example of suspend processing rsuspd = 1 (uf0is0) rsum = 1 (uf0eps1) yes suspend detected? no yes rsuspd = 1? (uf0is0) no yes rsum = 1? (uf0eps1) no start end intusb0b active reading uf0isn register reading uf0eps1 register fw suspend processing rsuspdc = 0 (uf0ic0) illegal processing illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 719 figure 11-26. example of suspend/resume processing (2/3) (b) example of resume processing rsuspd = 1 (uf0is0) rsum = 0 (uf0eps1) yes resume detected? no yes rsuspd = 1? (uf0is0) no yes rsum = 0? (uf0eps1) no start end intusb0b active reading uf0isn register reading uf0eps1 register fw resume processing rsuspdc = 0 (uf0ic0) illegal processing illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 720 figure 11-26. example of suspend/resume processing (3/3) (c) example of resume processing (when supply of usb clock to usbf is stopped) intrsum active yes resum e detected? no start end executing interrupt servicing supplying usb clock fw resum e processing remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 721 11.7.5 processing after power application the processing to be performed after power application differs depending on the configuration of the system. one example is given below. figure 11-27. example of processing after power application/power failure (1/3) (a) processing after power application (1/2) yes resume detected? no start start controlling port note 2 pull-up processing of d+ inactive note 1 pull-up processing of d+ active note 1 connection controlling port note 2 busrst = 1 (uf0is0) dflt = 1 (uf0mods) initialization of request data register area initialization of request data register area : see figure 11-11 initialization of request data register area . : see figure 11-11 initialization of request data register area . (a) notes 1. use one general-purpose port pin for the signal that controls switching of the pull-up resistor of the usb bus. 2. the input mode or control mode of the general-purpose port pin allocated in note 1 may be selected as the default value. note the active level of pull-up processing of d+ on power application. remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 722 figure 11-27. example of processing after power application/power failure (2/3) (a) processing after power application (2/2) receiving get_descriptor device request mpack = 1 (uf0mods) receiving set_address request setting uf0adrs register receiving set_configuration 1 request receiving set_interface request processing continues setcon = 1 (uf0set) setrq = 1 (uf0is0) conf = 1 (uf0mods) uf0cnf register = 03h valid endpoint = data0 setint = 1 (uf0is4) setting of uf0ass register setting of uf0ifm register valid endpoint = data0 (a) remarks 1. m = 0 to 4 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 723 figure 11-27. example of processing after power application/power failure (3/3) (b) processing on power failure yes intpxx active note ? no interrupt servicing processing such as clearing fifo or mrst = 1 (uf0gpr) start end power failure note intpxx means an external interrupt pin of the v850e/me2 (intp10, intp11, intp21 to intp25, intp50 to intp52, intp65 to intp67, intpd0 to intpd15, intpl0, intpl1, intpc00, intpc01, intpc10, intpc11, intpc20, intpc21, intpc30, and intpc31). allocate one external interrupt pin to the following applications. (a) detecting disconnection of the connector in the case of self-powered mode (sfpw bit of uf0dstl register = 1). in this case, monitor the vdd line of the usb connector, and input the result to the external interrupt pin at the edge. for the noise elimination time, see table 14-1 noise elimination time of interrupt input pins and table 14-3 noise elimination time of timer c and timer enc1 input pins . (b) detecting turning off power from a hub chip when the device is mounted on the same board as a hub. remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 724 11.7.6 receiving data for bulk transfer (out) in dma mode bulk transfer (out) is allocated to endpoint2 and endpoint4. the flowchart shown below illustrates how endpoint2 is controlled when dma is used. endpoint4 can also be controlled in the same sequence. to use this flowchart as the control flow of endpoint4, therefore, read the bit names of endpoint2 in the flowchart as those of endpoint4. the control flowchart shown below illustrates how remaining data is read by the cpu. if data for bulk transfer (out) has been correctly received by setting the dqbo1ms bit of the uf0idr register to 1, the dma request signal for endpoint2, instead of an interrupt request (intusb1b), becomes active. this dma request signal for endpoint2 operates according to the setting of the moden bit of the uf0idr register (n = 0, 1). if all the data stored in the uf0bo1 register has been read by dma, the dma request signal for endpoint2 becomes inactive. in this status, if data for the next bulk transfer (out) has been correctly received, the dma request signal for endpoint2 becomes active again. if the data for bulk transfer (out) that has been received is equal to or less than the fifo size, a short interrupt request is issued and the usbsp2b signal becomes active, as soon as reading the data by dma is completed. as a result, the dqbo1ms bit of the uf0idr register is cleared to 0, and the dma request signal for endpoint2 becomes inactive. to read data by dma again, set the dqbo1ms bit to 1 again. if dma is completed by the dma end signal for endpoint2, the dqbo1ms bit of the uf0idr register is cleared to 0, and the dma request signal for endpoint2 becomes inactive. at the same time, the dma_end interrupt request is issued. if data remains in the uf0bo1 register at this time, dma can be started again by setting the dqbo1ms bit of the uf0idr register again. however, the data for bulk transfer (out) is always equal to or less than the fifo size. consequently, a short interrupt request is issued, the usbsp2b signal becomes active, the dqbo1ms bit is cleared, and the dma request signal for endpoint2 becomes inactive, as soon as the data is read by dma. cautions 1. the dma request signal for endpoint n (n = 2, 4) becomes active in the demand mode (mode1 and mode0 bits of the uf0idr register = 10), as long as there is data to be transferred. 2. the dma request signal for endpoint n (n = 2, 4) becomes active in the single mode (mode1 and mode0 bits of the uf0idr register = 0x (x: don?t care)) if there is data to be transferred, but this signal becomes inactive each time one byte has been transferred. this operation is repeated until there is no more data to be transferred.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 725 figure 11-28. dma processing by bulk transfer (out) (1/3) yes how many times is data length? no start no tc signal received? yes clearing uf0bo1 register yes normal reception? no setting of modex (uf0idr) dqbo1ms = 1 (uf0idr) bko1dt = 1 (uf0is3) bkout1 = 1 (uf0eps0) dqe2 = 1 (uf0dms0) bko1dt = 0 (uf0is3) bkout1 = 0 (uf0eps0) dqe2 = 0 (uf0dms0) writing uf0bo1 register dma request for endpoint2 active reading all data in uf0bo1 register by dma yes out token received? no (4) (3) no maxpacket? yes mode1, mode0 = 1 0: demand mode mode1, mode0 = 0 x: single mode (x = don ? t care) uf0bo1 register data is read up to the value read by the uf0bo1l register. (1) (2) remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 726 figure 11-28. dma processing by bulk transfer (out) (2/3) yes short = 1? (uf0is0) no intusb0b active dma request for endpoint2 inactive reading uf0isn register reading uf0dmsn register yes dspe2 = 1? (uf0dms1) no shortc = 0 (uf0ic0) correct processing dede2 = 1 (uf0dms1) short = 1 (uf0is0) dqbo1ms = 0 (uf0idr) (2) (3) illegal processing illegal processing remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 727 figure 11-28. dma processing by bulk transfer (out) (3/3) (1) (4) intusb0b active dma request for endpoint2 inactive yes dmaed = 1? (uf0is0) no yes dede2 = 1? (uf0dms1) no yes bko1dt = 1? (uf0is3) no dqe2 = 0 (uf0dms0) dede2 = 1 (uf0dms1) dmaed = 1 (uf0is0) dqbo1ms = 0 (uf0idr) reading uf0isn register reading uf0dmsn register reading uf0ism register updating data length of uf0bo1l register reading uf0bo1 register data length = data length ? 1 no data length other than 0? yes uf0bo1 register data is read up to the value read by the uf0bo1l register. bko1dt = 0 (uf0is3) bkout1 = 0 (uf0eps0) dmaedc = 0 (uf0ic0) illegal processing illegal processing remarks 1. n = 0, 1 m = 2, 3 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 728 11.7.7 transmitting data for bulk transfer (in) in dma mode bulk transfer (in) is allocated to endpoint1 and endpoint3. the flowchart shown below illustrates how endpoint1 is controlled when dma is used. endpoint3 can also be controlled in the same sequence. to use this flowchart as the control flow of endpoint3, therefore, read the bit names of endpoint1 in the flowchart as those of endpoint3. if data for bulk transfer (in) can be written by setting the dqbi1ms bit of the uf0idr register to 1, the dma request signal for endpoint1, instead of an interrupt request (intusb1b), becomes active. this dma request signal for endpoint1 operates according to the setting of the moden bit of the uf0idr register (n = 0, 1). if all the data that can be written to the uf0bi1 register has been written by dma, the dma request signal for endpoint1 becomes inactive. in this status, the toggle operation of the fifo takes place and, if data for bulk transfer (in) can be written, the dma request signal for endpoint1 becomes active again. the automatic toggle operation of the fifo is not executed even if the fifo has become full as a result of dma transfer, unless the bki1t bit of the uf0dend register is set to 1. therefore, be sure to set the bki1ded bit of the uf0dend register to 1 to transfer data. if dma is completed by the dma end signal for endpoint1, the dqbi1ms bit of the uf0idr register is cleared to 0, and the dma request signal for endpoint1 becomes inactive. at the same time, the dma_end interrupt request is issued. to transmit a short packet at this time when the fifo is not full, set the bki1ded bit of the uf0dend register to 1. cautions 1. the dma request signal for endpoint n (n = 1, 3) becomes active in the demand mode (mode1 and mode0 bits of the uf0idr register = 10), as long as data can be transferred. 2. the dma request signal for endpoint n (n = 1, 3) becomes active in the single mode (mode1 and mode0 bits of the uf0idr register = 0x (x: don?t care)) if data can be transferred, but this signal becomes inactive each time one byte has been transferred. this operation is repeated until there is no more data to be transferred.
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 729 figure 11-29. dma processing by bulk transfer (in) (1/4) start setting of modex (uf0idr) dqbi1ms = 1 (uf0idr) dqe1 = 1 (uf0dms0) no fifo on cpu side full? yes mode1, mode0 = 1 0: demand mode mode1, mode0 = 0 x: single mode (x = don ? t care) yes fifo full? no no tc signal received? yes dma request for endpoint1 active writing uf0bi1 register by dma if return data greater than the fifo size exists, it is divided into fifo size units, and sequentially written, starting from the lowest data byte. (3) (5) (1) yes bki1t = 1? (uf0dend) no (2) remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 730 figure 11-29. dma processing by bulk transfer (in) (2/4) end bki1nk = 1 (uf0en) note bki1dt = 1 (uf0is2) note dqe1 = 0 (uf0dms0) dma request for endpoint1 inactive parallel processing by hardware (3) (2) : see figure 11-22 parallel processing by hardware . note the timing of the bit value changes depending on the status on the sie side. remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 731 figure 11-29. dma processing by bulk transfer (in) (3/4) (1) intusb0b active dma request for endpoint1 inactive bki1nk = 1 (uf0en) note bki1dt = 1 (uf0is2) note dqe1 = 0 (uf0dms0) dede1 = 1 (uf0dms1) dmaed = 1 (uf0is0) dqbi1ms = 0 (uf0idr) dqe1 = 0 (uf0dms0) dede1 = 1 (uf0dms1) dmaed = 1 (uf0is0) dqbi1ms = 0 (uf0idr) yes dmaed = 1? (uf0is0) no yes dede1 = 1? (uf0dms1) no no yes yes bki1t = 1? (uf0dend) fifo full? no reading uf0isn register reading uf0dmsn register (4) illegal processing illegal processing note the timing of the bit value changes depending on the status on the sie side. remarks 1. n = 0, 1 2. ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 732 figure 11-29. dma processing by bulk transfer (in) (4/4) (5) end dmaedc = 0 (uf0ic0) (5) no yes yes bki1t = 1? (uf0dend) fifo full? no bki1ded = 1 (uf0dend) bki1nk = 1 (uf0en) note bki1dt = 1 (uf0is2) note bki1cc = 1 (uf0fic0) dmaedc = 0 (uf0ic0) no data error? yes (4) parallel processing by hardware : see figure 11-22 parallel processing by hardware . note the timing of the bit value changes depending on the status on the sie side. remark ? : processing by hardware
chapter 11 usb function controller (usbf) preliminary user ? s manual u16031ej2v1ud 733 11.7.8 usb connection example figure 11-30. usb connection example v850e/me2 uv dd ic1 ic2 uv dd p50 intp51 udp udm d+ vbus d ? 24 ? 5% 24 ? 5% 1.5 k ? 5% (1) pull-up control of d+ to prohibit connection report (d+ pull-up) to the usb host/hub (such as while higher priority processing or initialization processing is under execution), the system must control pulling up of d+ via a general-purpose port. as shown in the circuit example in figure 11-30, control the pull-up control signal of d+ and vbus input signal by using a general-purpose port and usb cable vbus (and circuit). in figure 11-30, pulling up d+ is prohibited when the general-purpose port is high level (secure the high level of the general-purpose port pin by pulling it up because the port pin is in the input mode by default). use an ic to which power can be applied when the system power supply is off as ic2 shown in figure 11-30. (2) detecting usb cable connection/disconnection the usb function controller (usbf) requires a vbus input signal that recognizes connection and disconnection, because the state of usbf is managed by hardware. voltage (5 v) is applied from the usb host/hub as the vbus input signal if the usb cable vbus is connected to the usb host/hub when power to the usbf is turned off. therefore, use an ic to which power can be applied when the system power supply is off as ic1 shown in figure 11-30.
734 preliminar y user?s manual u16031ej2v1ud chapter 12 a/d converter 12.1 features ? analog input: 8 channels ? 10-bit a/d converter ? on-chip a/d conversion result register (adcr0 to adcr7) 10 bits 8 ? a/d conversion trigger mode a/d trigger mode timer trigger mode external trigger mode ? successive approximation method
chapter 12 a/d converter 735 preliminar y user?s manual u16031ej2v1ud 12.2 configuration the a/d converter of the v850e/me2 adopts the successive approximation method, and uses a/d converter mode registers 0, 1, 2 (adm0, adm1, adm2), and the a/d conversion result register (adcr0 to adcr7) to perform a/d conversion operations. (1) input circuit the input circuit selects the analog input (ani0 to ani7) according to the mode set by the adm0, adm1, and adm2 registers. (2) c-array holds the charge of the differential voltage between the voltage input from the analog input pins (ani0 to ani7) and the reference voltage (1/2 av dd ), and redistributes the sampled charges. (3) c-dummy this block holds the reference voltage (1/2 av dd ) and assigns the reference of the comparator input. (4) voltage comparator the voltage comparator compares the c-array comparison potential with the c-dummy reference potential. (5) a/d conversion result register n (adcrn), a/d conversion result register nh (adcrnh) adcrn is a 10-bit register that holds a/d conversion results. each time a/d conversion is completed, the conversion results are loaded from the successive approximation register (sar). reset input makes this register undefined. (6) ani0 to ani7 pins these are 8-channel analog input pins for the a/d converter. they input the analog signals to be a/d converted. caution make sure that the voltages input to ani0 to ani7 do not exceed the rated values. if a voltage higher than av dd or lower than av ss (even within the range of the absolute maximum ratings) is input to a channel, the conversion value of the channel is undefined, and the conversion values of the other channels may also be affected. (7) av refm and av refp pins this is the pin for inputting the reference voltage of the a/d converter. it converts signals input to the ani0 to ani7 pins to digital signals based on the voltage applied between av refm and av refp . (8) av ss pin this is the ground pin of the a/d converter. always use this pin at the same potential as that of the ev ss pin even when the a/d converter is not used. (9) av dd pin this is the analog power supply pin of the a/d converter. always use this pin at the same potential as that of the ev dd pin even when the a/d converter is not used.
chapter 12 a/d converter 736 preliminar y user?s manual u16031ej2v1ud figure 12-1. block diagram of a/d converter comparator av refm av refp av dd av ss intad c-dummy c-array controller f x /8 adtrg adtrg ttrg successive approximation register (sar) a/d conversion result register (adcrn, adcrnh) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 intccc40 intccc41 intccc50 intccc51 trigger selector edge detection input circuit remarks 1. f x : main clock 2. n = 0 to 7 cautions 1. if there is noise at the analog input pins (ani0 to ani7) or at the reference voltage input pin (av refp , av refm ), that noise may generate an illegal conversion result. software processing will be needed to avoid a negative effect on the system from this illegal conversion result. an example of this software processing is shown below. ? ? ? ? take the average result of a number of a/d conversions and use that as the a/d conversion result. ? ? ? ? execute a number of a/d conversions consecutively and use those results, omitting any exceptional results that may have been obtained. 2. do not apply a voltage outside the av refm to av refp range to the pins that are used as a/d converter input pins.
chapter 12 a/d converter 737 preliminar y user ? s manual u16031ej2v1ud 12.3 control registers (1) a/d converter mode register 0 (adm0) the adm0 register is an 8-bit register that specifies the operation mode, and executes conversion operations. this register can be read or written in 8-bit or 1-bit units. however, bit 6 can only be read. writing this bit is ignored. cautions 1. when the adce bit is 1 in the timer trigger mode and external trigger mode, the trigger signal standby state is set. to clear the adce bit, write 0 or reset. in the a/d trigger mode, the conversion trigger is set by writing 1 to the adce bit. after the operation, when the mode is changed to the timer trigger mode or external trigger mode without clearing the adce bit, the trigger input standby state is set immediately after changing the register. 2. changing the setting of the bs and ms bits is prohibited while a/d conversion is enabled (adce bit = 1). 3. when data is written to the adm0 register during an a/d conversion operation, the conversion operation is initialized and conversion is executed from the beginning. adce adm0 adcs 5 bs 4 ms 3 0 2 0 1 0 0 0 address fffff200h after reset 00h <6> <7> bit position bit name function 7 adce enables or disables a/d conversion operation. 0: disabled 1: enabled 6 adcs indicates the status of a/d converter. this bit is read only. 0: stopped 1: operating 5 bs specifies buffer mode in the select mode. 0: 1-buffer mode 1: 4-buffer mode 4 ms specifies operation mode of a/d converter. 0: scan mode 1: select mode
chapter 12 a/d converter 738 preliminar y user ? s manual u16031ej2v1ud (2) a/d converter mode register 1 (adm1) the adm1 register is an 8-bit register that specifies the conversion operation time and trigger mode. this register can be read or written in 8-bit or 1-bit units. cautions 1. changing the setting of the ega1, ega0, and fr3 to fr0 bits is prohibited while a/d conversion is enabled (adce bit = 1 in the adm0 register). 2. when data is written to the adm1 register during an a/d conversion operation, the conversion operation is initialized and conversion is executed from the beginning. 7 ega1 adm1 6 ega0 5 trg1 4 trg0 3 fr3 2 fr2 1 fr1 0 fr0 address fffff201h after reset 00h bit position bit name function specify valid edge of adtrg. ega1 ega0 adtrg valid edge specification 0 0 no edge detected (does not operate as external trigger) 0 1 falling edge detected 1 0 rising edge detected 1 1 both edges detected 7, 6 ega1, ega0 specify the trigger mode. trg1 trg0 trigger mode 0 0 a/d trigger mode 0 1 timer trigger mode 1 0 external trigger mode 1 1 setting prohibited 5, 4 trg1, trg0 remark sets a/d conversion operation time by using bits fr3 to fr0. for details, see table 12-1 .
chapter 12 a/d converter 739 preliminar y user ? s manual u16031ej2v1ud table 12-1. setting of a/d conversion operation time conversion operation time note 1 fr3 fr2 fr1 fr0 number of conversion clocks f x = 150 mhz f x = 133 mhz f x = 100 mhz f x = 80 mhz a/d stabilization time note 2 0 0 0 0 128 setting prohibited setting prohibited setting prohibited setting prohibited 64/f x 0 0 0 1 256 setting prohibited setting prohibited 2.56 s3.20 s 128/f x 0 0 1 0 384 2.56 s2.89 s3.84 s4.80 s 160/f x 0 0 1 1 512 3.42 s3.85 s5.12 s6.40 s 160/f x 0 1 0 0 640 4.27 s4.82 s6.40 s8.00 s 160/f x 0 1 0 1 768 5.12 s5.78 s7.68 s9.60 s 160/f x 0 1 1 0 896 5.98 s6.74 s8.96 s setting prohibited 160/f x 0 1 1 1 1,024 6.83 s7.70 s setting prohibited setting prohibited 160/f x 1 0 0 0 1,152 7.68 s8.67 s setting prohibited setting prohibited 160/f x 1 0 0 1 1,280 8.54 s9.63 s setting prohibited setting prohibited 160/f x 1 0 1 0 1,408 9.39 s setting prohibited setting prohibited setting prohibited 160/f x 1 0 1 1 1,536 setting prohibited setting prohibited setting prohibited setting prohibited ? 1 1 0 0 1,664 setting prohibited setting prohibited setting prohibited setting prohibited ? 1 1 0 1 1,792 setting prohibited setting prohibited setting prohibited setting prohibited ? 1 1 1 0 1,920 setting prohibited setting prohibited setting prohibited setting prohibited ? 1 1 1 1 2,048 setting prohibited setting prohibited setting prohibited setting prohibited ? notes 1. set the conversion operation time in the range of 2 to 10 s (target value). 2. after the adce bit is set to ? 1 ? from ? 0 ? to secure the stabilization time of the a/d converter, conversion is started after the a/d stabilization time has elapsed only before the first a/d conversion is executed. cautions 1. do not change the set value of the a/d conversion time (fr3 to fr0 bits) during an a/d conversion operation (adce bit = 1). to change the value, clear the adce bit to 0. 2. when the trigger mode (trg1 and tgr0 bits) is changed midway, a/d conversion can be started immediately without having to secure the a/d stabilization time by re-setting the adce bit to ?1?. remark f x : main clock
chapter 12 a/d converter 740 preliminar y user ? s manual u16031ej2v1ud (3) a/d converter mode register 2 (adm2) the adm2 register is an 8-bit register that specifies the analog input pin of the a/d converter. this register can be read or written in 8-bit or 1-bit units. cautions 1. if a channel for which no analog input pin exists is specified, the result of a/d conversion is undefined. 2. changing the setting of the anis2 to anis0 bits is prohibited while a/d conversion is enabled (adce bit = 1 in the adm0 register). 3. when data is written to the adm2 register during an a/d conversion operation, the conversion operation is initialized and conversion is executed from the beginning. 7 0 adm2 6 0 5 0 4 0 3 0 2 anis2 1 anis1 anis0 address fffff202h after reset 00h 0 bit position bit name function specify the analog input pin for a/d conversion. specification of pin for a/d conversion anis2 anis1 anis0 select mode scan mode 0 0 0 ani0 ani0 0 0 1 ani1 ani0, ani1 0 1 0 ani2 ani0 to ani2 0 1 1 ani3 ani0 to ani3 1 0 0 ani4 ani0 to ani4 1 0 1 ani5 ani0 to ani5 1 1 0 ani6 ani0 to ani6 1 1 1 ani7 ani0 to ani7 2 to 0 anis2 to anis0
chapter 12 a/d converter 741 preliminar y user ? s manual u16031ej2v1ud (4) adc trigger select register (adts) this is an 8-bit register that specifies the timer trigger signal in the timer trigger mode. this register can be read or written in 8-bit units. be sure to clear bits 7 to 4 to 0. if they are set to 1, the operation is not guaranteed. caution before changing the setting of the adts register, stop the a/d conversion operation (by clearing the adce bit of the adm0 register to 0). the operation is not guaranteed if the setting of the adts register is changed while a/d conversion is enabled (adce bit = 1). 7 0 adts 6 0 5 0 4 0 <3> tms3 <2> tms2 <1> tms1 tms0 address fffff220h after reset 00h <0> bit position bit name function 3 tms3 controls connection of a timer trigger signal (intccc51). 0: timer trigger of adc is invalid. 1: timer trigger of adc is valid. 2 tms2 controls connection of a timer trigger signal (intccc50). 0: timer trigger of adc is invalid. 1: timer trigger of adc is valid. 1 tms1 controls connection of a timer trigger signal (intccc41). 0: timer trigger of adc is invalid. 1: timer trigger of adc is valid. 0 tms0 controls connection of a timer trigger signal (intccc40). 0: timer trigger of adc is invalid. 1: timer trigger of adc is valid.
chapter 12 a/d converter 742 preliminar y user ? s manual u16031ej2v1ud (5) a/d conversion result registers 0 to 7, 0h to 7h (adcr0 to adcr7, adcr0h to adcr7h) the adcrn register is a 10-bit register holding the a/d conversion results. there are eight 10-bit registers. these registers are read-only in 16-bit or 8-bit units. during 16-bit access, the adcrn register is specified, and during higher 8-bit access, the adcrnh register is specified (n = 0 to 7). when reading the 10-bit data of the a/d conversion results from the adcrn register, only the higher 10 bits are valid and the lower 6 bits are always read as 0. 15 adn9 14 adn8 13 adn7 12 adn6 11 adn5 10 adn4 9 adn3 8 adn2 7 adn1 6 adn0 5 0 4 0 3 0 2 0 1 0 0 0 adcrn address fffff210h to fffff21eh after reset undefined 7 adn9 6 adn8 5 adn7 4 adn6 3 adn5 2 adn4 1 adn3 0 adn2 adcrnh address fffff211h to fffff21fh after reset undefined remark n = 0 to 7 the correspondence between each analog input pin and the adcrn register is shown below. adcrn register analog input pin select 1 buffer mode/ scan mode select 4 buffer mode ani0 adcr0, adcr0h ani1 adcr1, adcr1h ani2 adcr2, adcr2h ani3 adcr3, adcr3h adcr0 to adcr3, adcr0h to adcr3h ani4 adcr4, adcr4h ani5 adcr5, adcr5h ani6 adcr6, adcr6h ani7 adcr7, adcr7h adcr4 to adcr7, adcr4h to adcr7h
chapter 12 a/d converter 743 preliminar y user ? s manual u16031ej2v1ud the relationship between the analog voltage input to the analog input pins (ani0 to ani7) and the a/d conversion result (of the a/d conversion result register (adcrn)) is as follows: 0.5) 1,024 av v ( int adcr ref in + = or, 1,024 av 0.5) (adcr v 1,024 av 0.5) (adcr ref in ref + < ? int( ): function that returns the integer of the value in ( ) v in : analog input voltage av ref : av refm , av refp pin voltage adcr: value of a/d conversion result register (adcrn) figure 12-2 shows the relationship between the analog input voltage and the a/d conversion results. figure 12-2. relationship between analog input voltage and a/d conversion results 1,023 1,022 1,021 3 2 1 0 input voltage/av refp , av refm 1 2,048 1 1,024 3 2,048 2 1,024 5 2,048 3 1,024 2,043 2,048 1,022 1,024 2,045 2,048 1,023 1,024 2,047 2,048 1 a/d conversion results (adcrn) remark n = 0 to 7
chapter 12 a/d converter 744 preliminar y user ? s manual u16031ej2v1ud 12.4 operation 12.4.1 basic operation a/d conversion is executed by the following procedure. (1) the selection of the analog input and specification of the operation mode, trigger mode, etc. should be specified using the admn register note 1 (n = 0 to 2). when the adce bit of the adm0 register is set to 1, a/d conversion starts in the a/d trigger mode. in the timer trigger mode and external trigger mode, the trigger standby state note 2 is set. (2) when a/d conversion is started, the c array voltage on the analog input side and the c array voltage on the reference side are compared by the comparator. (3) when the comparison of the 10 bits ends, the conversion results are stored in the adcrn register. when a/d conversion has been performed the specified number of times, the a/d conversion end interrupt (intad) is generated (n = 0 to 7). notes 1. if the setting of the admn register (n = 0 to 2) is changed during a/d conversion, the operation immediately before is stopped, and the result of the conversion is not stored in the adcrn register (n = 0 to 7). the a/d conversion operation is then initialized, and conversion is executed from the beginning again. 2. during the timer trigger mode and external trigger mode, if the adce bit of the adm0 register is set to 1, the mode changes to the trigger standby state. the a/d conversion operation is started by the trigger signal (adcs bit = 1 in the adm0 register), and the trigger standby state (adcs bit = 0) is returned when the a/d conversion operation ends.
chapter 12 a/d converter 745 preliminar y user ? s manual u16031ej2v1ud 12.4.2 operation mode and trigger mode various conversion operations can be specified for the a/d converter by specifying the operation mode and trigger mode. the operation mode and trigger mode are set by the adm0 to adm2 registers. the following shows the relationship between the operation mode and trigger mode. table 12-2. relationship between operation mode and trigger mode set value trigger mode operation mode adm0 adm1 adm2 analog input 1 buffer xx010000b 00000xxxb ani0 to ani7 select 4 buffers xx110000b 00000xxxb ani0 to ani7 a/d trigger scan xxx00000b 00000xxxb 00000xxxb ani0 to ani7 1 buffer xx010000b 00000xxxb ani0 to ani7 select 4 buffers xx110000b 00000xxxb ani0 to ani7 timer trigger scan xxx00000b 00001xxxb 00000xxxb ani0 to ani7 1 buffer xx010000b 00000xxxb ani0 to ani7 select 4 buffers xx110000b 00000xxxb ani0 to ani7 external trigger scan xxx00000b xx10xxxxb 00000xxxb ani0 to ani7 (1) trigger mode there are three types of trigger modes that serve as the start timing of a/d conversion processing: a/d trigger mode, timer trigger mode, and external trigger mode. these trigger modes are set by the trg1 and trg0 bits of the adm1 register. (a) a/d trigger mode this mode starts the conversion timing of the analog input set to the ani0 to ani7 pins, and by setting the adce bit of the adm0 register to 1, starts a/d conversion. unless the adce bit is cleared to 0 after conversion, the next conversion operation is repeated. if data is written to the adm0 to adm2 registers during conversion, conversion is stopped and then executed from the beginning again. (b) timer trigger mode this mode specifies the conversion timing of the analog input set for the ani0 to ani7 pins using the values set to the timer c capture/compare register. this register creates the analog input conversion timing by generating the compare match interrupts of the four capture/compare registers (ccc40, ccc41, ccc50, ccc51) connected to the 16-bit timer c (tmc4, tmc5). if the adce bit of the adm0 register is set to 1, the a/d converter waits for an interrupt (intccc40, intccc41, intccc50, or intccc51), and starts conversion when intccc40, intccc41, intccc50, or intccc51 occurs (adcs bit = 1 in the adm0 register). when conversion has finished, the converter waits for an interrupt again (adcs = 0). if data is written to the adm0 to adm2 registers during conversion, conversion is stopped and then executed from the beginning again.
chapter 12 a/d converter 746 preliminar y user ? s manual u16031ej2v1ud (c) external trigger mode this mode specifies the conversion timing of the analog input to the ani0 to ani7 pins using the adtrg pin. the ega1 and ega0 bits of the adm1 register are used to specify the valid edge to be input to the adtrg pin. when the adce bit of the adm0 register is set to 1, the a/d converter waits for an external trigger (adtrg), and starts conversion when the valid edge of adtrg is detected (adcs bit = 1 in the adm0 register). when the converter has completed its conversion operation, it waits for an external trigger again (adcs bit = 0). if the valid edge is detected at the adtrg pin during conversion, conversion is executed from the beginning again. if data is written to the adm0 to adm2 registers during conversion, conversion is stopped and then executed from the beginning again. (2) operation mode there are two operation modes that set the ani0 to ani7 pins: select mode and scan mode. the select mode has sub-modes that consist of 1-buffer mode and 4-buffer mode. these modes are set by the bs and ms bits of the adm0 register. (a) select mode in this mode, one analog input specified by the adm2 register is a/d converted. the conversion results are stored in the adcrn register corresponding to the analog input (anin). for this mode, the 1-buffer mode and 4-buffer mode are provided for storing the a/d conversion results (n = 0 to 7). ? 1-buffer mode in this mode, one analog input specified by the adm2 register is a/d converted. the conversion results are stored in the adcrn register corresponding to the analog input (anin) (n = 0 to 7). the anin and adcrn register correspond one to one, and an a/d conversion end interrupt (intad) is generated each time one a/d conversion ends. after conversion has finished, the next conversion operation is repeated, unless the adce bit of the adm0 register is cleared to 0.
chapter 12 a/d converter 747 preliminar y user ? s manual u16031ej2v1ud figure 12-3. select mode operation timing: 1-buffer mode (ani1) ani1 (input) a/d conversion data 1 (ani1) data 2 (ani1) data 3 (ani1) data 4 (ani1) data 5 (ani1) data 6 (ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 1 (ani1) data 2 (ani1) data 3 (ani1) data 4 (ani1) data 5 (ani1) adcr1 register intad interrupt conversion start (adm0 register setting) adce bit set adce bit set adce bit set adce bit set conversion start (adm0 register setting) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter adcrn register analog input
chapter 12 a/d converter 748 preliminar y user ? s manual u16031ej2v1ud ? 4-buffer mode in this mode, one analog input is a/d converted four times and the results are stored in the adcrn register. the a/d conversion end interrupt (intad) is generated when the four a/d conversions end (n = 0 to 3 when the lower analog input channel is specified and n = 4 to 7 when the higher analog input channel is specified). after conversion has finished, the next conversion operation is repeated, unless the adce bit of the adm0 register is cleared to 0. figure 12-4. select mode operation timing: 4-buffer mode (ani2) ani2 (input) a/d conversion data 1 (ani2) data 2 (ani2) data 3 (ani2) data 4 (ani2) data 5 (ani2) data 6 (ani2) data 1 data 2 data 3 data 4 data 5 data 6 data 1 (ani2) adcr0 data 2 (ani2) adcr1 data 3 (ani2) adcr2 data 4 (ani2) adcr3 data 5 (ani2) adcr0 adcrn register intad interrupt conversion start (adm0 register setting) conversion start (adm0 register setting) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter adcrn register analog input
chapter 12 a/d converter 749 preliminar y user ? s manual u16031ej2v1ud (b) scan mode in this mode, the analog inputs specified by the adm2 register are selected sequentially from the ani0 pin, and a/d conversion is executed. the a/d conversion results are stored in the adcrn register corresponding to the analog input (n = 0 to 7). when the conversion of the specified analog input ends, the a/d conversion end interrupt (intad) is generated. after conversion has finished, the next conversion operation is repeated, unless the adce bit of the adm0 register is cleared to 0. figure 12-5. scan mode operation timing: 4-channel scan (ani0 to ani3) ani3 (input) ani0 (input) ani1 (input) ani2 (input) a/d conversion data 1 (ani0) data 2 (ani1) data 3 (ani2) data 4 (ani3) data 5 (ani0) data 6 (ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 1 (ani0) adcr0 data 2 (ani1) adcr1 data 3 (ani2) adcr2 data 4 (ani3) adcr3 data 5 (ani0) adcr0 adcrn register intad interrupt conversion start (adm0 register setting) conversion start (adm0 register setting) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter adcrn register analog input
chapter 12 a/d converter 750 preliminar y user ? s manual u16031ej2v1ud 12.5 operation in a/d trigger mode when the adce bit of the adm0 register is set to 1, a/d conversion is started. 12.5.1 select mode operation in this mode, the analog input specified by the adm2 register is a/d converted. the conversion results are stored in the adcrn register corresponding to the analog input. in the select mode, the 1-buffer mode and 4-buffer mode are supported according to the storing method of the a/d conversion results (n = 0 to 7). (1) 1-buffer mode (a/d trigger select: 1 buffer) in this mode, one analog input is a/d converted once. the conversion results are stored in one adcrn register. the analog input and adcrn register correspond one to one. each time an a/d conversion is executed, an a/d conversion end interrupt (intad) is generated and a/d conversion ends. the next conversion operation is repeated, unless the adce bit of the adm0 register is cleared to 0. analog input a/d conversion result register anin adcrn this mode is most appropriate for applications in which the results of each first-time a/d conversion are read. figure 12-6. example of 1-buffer mode operation (a/d trigger select: 1 buffer) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter adm2 (1) the adce bit of adm0 is set to 1 (enable) (2) ani2 is a/d converted (3) the conversion result is stored in adcr2 (4) the intad interrupt is generated
chapter 12 a/d converter 751 preliminar y user ? s manual u16031ej2v1ud (2) 4-buffer mode (a/d trigger select: 4 buffers) in this mode, one analog input is a/d converted four times and the results are stored in the adcrn register. when the 4th a/d conversion ends, an a/d conversion end interrupt (intad) is generated and the a/d conversion is stopped. the next conversion operation is repeated, unless the adce bit of the adm0 register is cleared to 0. analog input a/d conversion result register adcr0 (1st time) adcr1 (2nd time) adcr2 (3rd time) ani0 to ani3 adcr3 (4th time) adcr4 (1st time) adcr5 (2nd time) adcr6 (3rd time) ani4 to ani7 adcr7 (4th time) this mode is suitable for applications in which the average of the a/d conversion results is calculated. figure 12-7. example of 4-buffer mode operation (a/d trigger select: 4 buffers) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter adm2 ( 4) (1) the adce bit of adm0 is set to 1 (enable) (6) ani3 is a/d converted (2) ani3 is a/d converted (7) the conversion result is stored in adcr2 (3) the conversion result is stored in adcr0 (8) ani3 is a/d converted (4) ani3 is a/d converted (9) the conversion result is stored in adcr3 (5) the conversion result is stored in adcr1 (10) the intad interrupt is generated
chapter 12 a/d converter 752 preliminar y user ? s manual u16031ej2v1ud 12.5.2 scan mode operations in this mode, the analog inputs specified by the adm2 register are selected sequentially from the ani0 pin, and a/d conversion is executed. the a/d conversion results are stored in the adcrn register corresponding to the analog input (n = 0 to 7). when conversion of all the specified analog input ends, the a/d conversion end interrupt (intad) is generated, and a/d conversion is stopped. the next conversion operation is repeated, unless the adce bit of the adm0 register is cleared to 0. analog input a/d conversion result register ani0 adcr0 anin note adcrn note set by the anis2 to anis0 bits of the adm2 register. this mode is most appropriate for applications in which multiple analog inputs are constantly monitored. figure 12-8. example of scan mode operation (a/d trigger scan) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter adm2 (1) the adce bit of adm0 is set to 1 (enable) (8) ani3 is a/d converted (2) ani0 is a/d converted (9) the conversion result is stored in adcr3 (3) the conversion result is stored in adcr0 (10) ani4 is a/d converted (4) ani1 is a/d converted (11) the conversion result is stored in adcr4 (5) the conversion result is stored in adcr1 (12) ani5 is a/d converted (6) ani2 is a/d converted (13) the conversion result is stored in adcr5 (7) the conversion result is stored in adcr2 (14) the intad interrupt is generated . . . . . .
chapter 12 a/d converter 753 preliminar y user ? s manual u16031ej2v1ud 12.6 operation in timer trigger mode in this mode, the conversion timing of the analog input signal set by the ani0 to ani7 pins is defined by the value set to the capture/compare registers of timers c4 and c5. the analog input conversion timing is generated when a compare match interrupt (intccc40, intccc41, intccc50, or intccc51) is generated by the capture/compare register connected to 16-bit timer c4 or c5 (tmc4 or tmc5). when the adce bit of the adm0 register is set to 1, the a/d converter waits for the interrupt (intccc40, intccc41, intccc50, or intccc51), and starts conversion when intccc40, intccc41, intccc50, or intccc51 occurs (adcs bit = 1 in the adm0 register). when conversion is finished, the converter waits for an interrupt again (adcs bit = 0). if intccc40, intccc41, intccc50, or intccc51 occurs during conversion, the conversion operation is executed from the beginning again. if data is written to the adm0 to adm2 registers during conversion, the conversion operation is stopped and executed from the beginning again.
chapter 12 a/d converter 754 preliminar y user ? s manual u16031ej2v1ud 12.6.1 select mode operation in this mode, an analog input (ani0 to ani7) specified by the adm2 register is a/d converted. the conversion results are stored in the adcrn register corresponding to the analog input. in the select mode, the 1-buffer mode and 4-buffer mode are provided according to the storing method of the a/d conversion results. (1) 1-buffer mode (timer trigger select: 1 buffer) in this mode, one analog input is a/d converted once and the conversion results are stored in one adcrn register. one analog input is a/d converted once using the trigger of the match interrupt signals (intccc40, intccc41, intccc50, intccc51) and the results are stored in one adcrn register. an a/d conversion end interrupt (intad) is generated for each a/d conversion. unless the adce bit of the adm0 register is cleared to 0, a/d conversion is repeated each time a timer match interrupt is generated. table 12-3. correspondence between analog input pins and adcrn register (1-buffer mode (timer trigger select: 1 buffer)) trigger analog input a/d conversion result register intcccn interrupt ani0 adcr0 intcccn interrupt ani1 adcr1 intcccn interrupt ani2 adcr2 intcccn interrupt ani3 adcr3 intcccn interrupt ani4 adcr4 intcccn interrupt ani5 adcr5 intcccn interrupt ani6 adcr6 intcccn interrupt ani7 adcr7 remark n = 40, 41, 50, 51 figure 12-9. example of 1-buffer mode operation (timer trigger select: 1 buffer) (ani1) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter intccc40 (1) the adce bit of adm0 is set to 1 (enable) (2) the ccc40 compare is generated (3) ani1 is a/d converted (4) the conversion result is stored in adcr1 (5) the intad interrupt is generated
chapter 12 a/d converter 755 preliminar y user ? s manual u16031ej2v1ud (2) 4-buffer mode (timer trigger select: 4 buffers) in this mode, a/d conversion of one analog input is executed four times, and the results are stored in the adcrn register. one analog input is a/d converted four times using the match interrupt signals (intccc40, intccc41, intccc50, intccc51) as a trigger, and the results are stored in four adcrn registers. the a/d conversion end interrupt (intad) is generated when the four a/d conversions end. after conversion has finished, the next conversion is repeated, unless the adce bit of the adm0 register is cleared to 0. this mode is suitable for applications in which the average of the a/d conversion results is calculated. table 12-4. correspondence between analog input pins and adcrn register (4-buffer mode (timer trigger select: 4 buffers)) trigger analog input a/d conversion result register ani0 to ani3 adcr0 (1st time) adcr1 (2nd time) adcr2 (3rd time) adcr3 (4th time) intcccn interrupt ani4 to ani7 adcr4 (1st time) adcr5 (2nd time) adcr6 (3rd time) adcr7 (4th time) remark n = 40, 41, 50, 51 figure 12-10. example of 4-buffer mode operation (timer trigger select: 4 buffers) (ani3) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter intcc40 ( 4) ( 4) (1) the adce bit of adm0 is set to 1 (enable) (8) the ccc40 compare is generated (2) the ccc40 compare is generated (9) ani3 is a/d converted (3) ani3 is a/d converted (10) the conversion result is stored in adcr2 (4) the conversion result is stored in adcr0 (11) the ccc40 compare is generated (5) the ccc40 compare is generated (12) ani3 is a/d converted (6) ani3 is a/d converted (13) the conversion result is stored in adcr3 (7) the conversion result is stored in adcr1 (14) the intad interrupt is generated
chapter 12 a/d converter 756 preliminar y user ? s manual u16031ej2v1ud 12.6.2 scan mode operation in this mode, the analog inputs specified by the adm2 register are selected sequentially from the ani0 pin and are a/d converted the specified number of times using the timer match interrupt signal as a trigger. the result of conversion is stored in the adcrn register corresponding to the analog input. when all the specified analog input signals have been converted, an a/d conversion end interrupt (intad) occurs. after conversion has finished, the a/d converter waits for a trigger unless the adce bit of the adm0 register is cleared to 0. when a timer match interrupt occurs again, the converter starts a/d conversion again, starting from the ani0 input. this mode is most appropriate for applications in which multiple analog inputs are constantly monitored. table 12-5. correspondence between analog input pins and adcrn register (scan mode (timer trigger scan)) trigger analog input a/d conversion result register ani0 adcr0 ani1 adcr1 ani2 adcr2 ani3 adcr3 ani4 adcr4 ani5 adcr5 ani6 adcr6 intcccn interrupt ani7 adcr7 remark n = 40, 41, 50, 51 figure 12-11. example of scan mode operation (timer trigger scan) (ani0 to ani4) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter intccc40 (1) the adce bit of adm0 is set to 1 (enable) (8) the conversion result is stored in adcr2 (2) the ccc40 compare is generated (9) ani3 is a/d converted (3) ani0 is a/d converted (10) the conversion result is stored in adcr3 (4) the conversion result is stored in adcr0 (11) ani4 is a/d converted (5) ani1 is a/d converted (12) the conversion result is stored in adcr4 (6) the conversion result is stored in adcr1 (13) the intad interrupt is generated (7) ani2 is a/d converted
chapter 12 a/d converter 757 preliminar y user ? s manual u16031ej2v1ud 12.7 operation in external trigger mode in this mode, the conversion timing of the analog signals input to the ani0 to ani7 pins is specified by the adtrg pin. detection of the valid edge at the adtrg input pin is specified by using the ega1 and ega0 bits of the adm1 register. when the adce bit of the adm0 register is set to 1, the a/d converter waits for an external trigger (adtrg), and starts conversion when the valid edge of adtrg is detected (adcs bit = 1 in the adm0 register). when the converter has ended conversion, it waits for the external trigger again (adcs bit = 0). if the valid edge is detected at the adtrg pin during conversion, conversion is executed from the beginning again. if data is written to the adm0 to adm2 registers during conversion, conversion is stopped and executed from the beginning again. 12.7.1 select mode operations in this mode, one analog input (ani0 to ani7) specified by the adm2 register is a/d converted. the conversion results are stored in the adcrn register corresponding to the analog input. in the select mode, there are two select modes: 1-buffer mode and 4-buffer mode, according to the storing method of the conversion results. (1) 1-buffer mode (external trigger select: 1-buffer) in this mode, one analog input is a/d converted using the adtrg signal as a trigger. the conversion results are stored in one adcrn register. the analog input and the a/d conversion results register correspond one to one. the a/d conversion end interrupt (intad) is generated for each a/d conversion, and a/d conversion is stopped. trigger analog input a/d conversion result register adtrg signal anin adcrn while the adce bit of the adm0 register is 1, a/d conversion is repeated every time a trigger is input from the adtrg pin. this mode is most appropriate for applications in which the results are read after each a/d conversion.
chapter 12 a/d converter 758 preliminar y user ? s manual u16031ej2v1ud figure 12-12. example of 1-buffer mode operation (external trigger select: 1 buffer) (ani1) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter adtrg (1) the adce bit of adm0 is set to 1 (enable) (2) the external trigger is generated (3) ani1 is a/d converted (4) the conversion result is stored in adcr1 (5) the intad interrupt is generated
chapter 12 a/d converter 759 preliminar y user ? s manual u16031ej2v1ud (2) 4-buffer mode (external trigger select: 4 buffers) in this mode, one analog input is a/d converted four times using the adtrg signal as a trigger and the results are stored in the adcrn register. the a/d conversion end interrupt (intad) is generated and a/d conversion is stopped after the 4th a/d conversion. trigger analog input a/d conversion result register adcr0 (1st time) adcr1 (2nd time) adcr2 (3rd time) ani0 to ani3 adcr3 (4th time) adcr4 (1st time) adcr5 (2nd time) adcr6 (3rd time) adtrg signal ani4 to ani7 adcr7 (4th time) while the adce bit of the adm0 register is 1, a/d conversion is repeated every time a trigger is input from the adtrg pin. this mode is suitable for applications in which the average of the a/d conversion results is calculated. figure 12-13. example of 4-buffer mode operation (external trigger select: 4 buffers) (ani2) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter ( 4) ( 4) adtrg (1) the adce bit of adm0 is set to 1 (enable) (8) the external trigger is generated (2) the external trigger is generated (9) ani2 is a/d converted (3) ani2 is a/d converted (10) the conversion result is stored in adcr2 (4) the conversion result is stored in adcr0 (11) the external trigger is generated (5) the external trigger is generated (12) ani2 is a/d converted (6) ani2 is a/d converted (13) the conversion result is stored in adcr3 (7) the conversion result is stored in adcr1 (14) the intad interrupt is generated
chapter 12 a/d converter 760 preliminar y user ? s manual u16031ej2v1ud 12.7.2 scan mode operation in this mode, the analog inputs specified by the adm2 register are selected sequentially from the ani0 pin using the adtrg signal as a trigger, and a/d converted. the a/d conversion results are stored in the adcrn register corresponding to the analog input (n = 0 to 7). when conversion of all the specified analog inputs has ended, the a/d conversion end interrupt (intad) is generated. unless the adce bit of the adm0 register is cleared to 0 after end of conversion, the a/d converter waits for a trigger. the converter starts a/d conversion from the ani0 input when a trigger is input to the adtrg pin again. trigger analog input a/d conversion result register ani0 adcr0 ani1 adcr1 ani2 adcr2 ani3 adcr3 ani4 adcr4 ani5 adcr5 ani6 adcr6 adtrg signal ani7 adcr7 when a trigger is input to the adtrg pin while the adce bit of the adm0 register is 1, a/d conversion is started again. this is most appropriate for applications in which multiple analog inputs are constantly monitored. figure 12-14. example of scan mode operation (external trigger scan) (ani0 to ani3) ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 adcr0 adcr1 adcr2 adcr3 adcr4 adcr5 adcr6 adcr7 a/d converter adtrg (1) the adce bit of adm0 is set to 1 (enable) (7) ani2 is a/d converted (2) the external trigger is generated (8) the conversion result is stored in adcr2 (3) ani0 is a/d converted (9) ani3 is a/d converted (4) the conversion result is stored in adcr0 (10) the conversion result is stored in adcr3 (5) ani1 is a/d converted (11) the intad interrupt is generated (6) the conversion result is stored in adcr1
chapter 12 a/d converter 761 preliminar y user ? s manual u16031ej2v1ud 12.8 notes on operation (1) stopping conversion operation when the adce bit of the adm0 register is cleared to 0 during a conversion operation, the conversion operation stops and the conversion results are not stored in the adcrn register (n = 0 to 7). (2) external/timer trigger interval set the interval (input time interval) of the trigger in the external or timer trigger mode longer than the conversion time specified by the fr3 to fr0 bits of the adm1 register. when 0 < interval conversion operation time when the following external trigger or timer trigger is input during a conversion operation, the conversion operation is aborted and the conversion starts according to the last external trigger input or timer trigger input. when conversion operations are aborted, the conversion results are not stored in the adcrn register (n = 0 to 7). however, the number of times the trigger has been input is counted. when an interrupt occurs, the values that have been converted are stored in the adcrn register. (3) operation in standby mode <1> halt mode in this mode, a/d conversion continues. when this mode is released by nmi input or unmasked maskable interrupt input (see 8.6.3 (2) release of halt mode ), the adm0, adm1, and adm2 registers and adcrn register hold the value (n = 0 to 7). <2> idle mode, software stop mode as clock supply to the a/d converter is stopped, no conversion operations are performed. when these modes are released by nmi input, the adm0, adm1, and adm2 registers and the adcrn register hold the value (n = 0 to 7). however, when the idle or software stop mode is set during a conversion operation, the conversion operation is stopped. at this time, if the mode released by nmi input or unmasked maskable interrupt input (see 8.6.4 (2) release of idle mode , 8.6.5 (2) release of software stop mode ), the conversion operation resumes, but the conversion result written to the adcrn register will become undefined. (4) compare match interrupt in timer trigger mode the compare register ? s match interrupt becomes an a/d conversion start trigger and starts the conversion operation. when this happens, the compare register ? s match interrupt also functions as a compare register match interrupt for the cpu. in order to prevent match interrupts from the compare register for the cpu, disable interrupts using the interrupt mask bits (ccc4mk0, ccc4mk1, ccc5mk0, ccc5mk1) of the interrupt control register (ccc4ic0, ccc4ic1, ccc5ic0, ccc5ic1). (5) input range of ani0 to ani7 use the input voltage at ani0 to ani7 within the specified range. if a voltage outside the range of av refp and av refm is input to any of these pins (even within the absolute maximum rating range), the converted value of the channel is undefined. in addition, the converted value of the other channels may also be affected.
chapter 12 a/d converter 762 preliminar y user ? s manual u16031ej2v1ud (6) conflict <1> conflict between writing a/d conversion result registers (adcrn, adcrnh) at end of conversion and reading adcrn and adcrnh registers by instruction reading the adcrn and adcrnh registers takes precedence. after these registers have been read, the new conversion result is written to the adcrn and adcrnh registers. <2> conflict between writing adcrn and adcrnh at end of conversion and input of external trigger signal the external trigger signal is not accepted during a/d conversion. therefore, it is not accepted while adcrn and adcrnh are being written. <3> conflict between writing adcrn and adcrnh at end of conversion and writing a/d converter mode register 1 (adm1) or a/d converter mode register 2 (adm2) if adm1 or adm2 is written immediately after adcrn and adcrnh have been written on completion of a/d conversion, the conversion result is written to the adcrn and adcrnh registers, but the a/d conversion end interrupt (intad) may not occur depending on the timing.
chapter 12 a/d converter 763 preliminar y user ? s manual u16031ej2v1ud 12.9 how to read a/d converter characteristics table here, special terms unique to the a/d converter are explained. (1) resolution this is the minimum analog input voltage that can be identified. that is, the percentage of the analog input voltage per bit of digital output is called 1lsb (least significant bit). the percentage of 1lsb with respect to the full scale is expressed by %fsr (full scale range). %fsr indicates the ratio of analog input voltage that can be converted as a percentage, and is always represented by the following formula regardless of the resolution. 1%fsr = (max. value of analog input voltage that can be converted ? min. value of analog input voltage that can be converted)/100 = (av refp ? av refm )/100 1lsb is as follows when the resolution is 10 bits. 1lsb = 1/2 10 = 1/1024 = 0.098%fsr accuracy has no relation to resolution, but is determined by overall error. (2) overall error this shows the maximum error value between the actual measured value and the theoretical value. zero-scale error, full-scale error, linearity error and errors that are combinations of these express the overall error. note that the quantization error is not included in the overall error in the characteristics table. figure 12-15. overall error ideal line 0 ?? 0 1 ?? 1 digital output overall error analog input av refp av refm
chapter 12 a/d converter 764 preliminar y user ? s manual u16031ej2v1ud (3) quantization error when analog values are converted to digital values, a 1/2lsb error naturally occurs. in an a/d converter, an analog input voltage in a range of 1/2lsb is converted to the same digital code, so a quantization error cannot be avoided. note that the quantization error is not included in the overall error, zero-scale error, full-scale error, integral linearity error, and differential linearity error in the characteristics table. figure 12-16. quantization error 0 ?? 0 1 ?? 1 digital output quantization error 1/2lsb 1/2lsb analog input av refm av refp (4) zero-scale error this shows the difference between the actual measurement value of the analog input voltage and the theoretical value (1/2 lsb) when the digital output changes from 0 ?? 000 to 0 ?? 001. figure 12-17. zero-scale error 111 011 010 001 zero-scale error ideal line 000 0 1 2 3 1023 digital output (lower 3 bits) analog input (lsb) ? 1 100
chapter 12 a/d converter 765 preliminar y user ? s manual u16031ej2v1ud (5) full-scale error this shows the difference between the actual measurement value of the analog input voltage and the theoretical value (3/2lsb) when the digital output changes from 1 ?? 110 to 1 ?? 111. figure 12-18. full-scale error 100 011 010 000 ? 0 1024 1023 1022 1021 digital output (lower 3 bits) analog input (lsb) full-scale error 111 (6) differential linearity error while the ideal width of code output is 1lsb, this indicates the difference between the actual measurement value and the ideal value. figure 12-19. differential linearity error av refm av refp digital output analog input differential linearity error 1 ?? 1 0 ?? 0 ideal 1lsb width
chapter 12 a/d converter 766 preliminar y user ? s manual u16031ej2v1ud (7) integral linearity error this shows the degree to which the conversion characteristics deviate from the ideal linear relationship. it expresses the maximum value of the difference between the actual measurement value and the ideal straight line when the zero-scale error and full-scale error are 0. figure 12-20. integral linearity error av refm av refp digital output analog input integral linearity error ideal line 1 ?? 1 0 ?? 0 (8) conversion time this expresses the time from when the analog input voltage was applied to the time when the digital output was obtained. the sampling time is included in the conversion time in the characteristics table. (9) sampling time this is the time the analog switch is turned on for the analog voltage to be sampled by the sample & hold circuit. figure 12-21. sampling time sampling time conversion time
preliminary user?s manual u16031ej2v1ud 767 chapter 13 pwm unit 13.1 features ? pwmn: 2 channels ? 12- to 16-bit accuracy selectable ? minimization of low-pass filter size due to main pulse + ancillary pulse configuration main pulse 4/5/6/7/8 bits ancillary pulse 8 bits ? repeat frequency: 129 khz to 2 mhz (f pwmc = 33 mhz) ? selecting pulse width rewrite period: every 1 pulse/256 pulses ? active level of pwm output pulse selectable ? pwm operating clock (f pwmc ): f x /4, f x /8, f x /16, or f x /32 selectable remarks 1. n = 0, 1 2. f pwmc : pwm operating clock f x : main clock 13.2 configuration pwmn has a pwm output configuration of 256 main pulses and sets the active-level width using modulo h register n. (1) prescaler the prescaler divides f x to generate the pwm operating clock (f pwmc ). the output frequency of the prescaler can be selected from f x /4, f x /8, f x /16, and f x /32, by using the ckspn1 and ckspn0 bits of the pwmcn register (n = 0, 1). (2) reload controller the reload controller controls reloading of the modulo register value. the reload timing (pwm pulse width rewrite period) can be selected from 2 x /f pwmc or 2 x+8 /f pwmc by using the synn bit of the pwmcn register (n = 0, 1, x = 4 to 8 (main pulse bit length)). (3) main pulse generator/output controller this circuit controls the output timing of the main pulse. it generates the main pulse from the reload signal generated by the reload controller, according to the value of modulo h register n (n = 0, 1). (4) ancillary pulse generator/output controller this circuit controls the output timing of the ancillary pulse. it generates an ancillary pulse from the reload signal generated by the reload controller, according to the value of modulo l register n (n = 0, 1).
chapter 13 pwm unit preliminary user?s manual u16031ej2v1ud 768 (5) pulse synthesizer/output controller this circuit controls the timing of the pwm pulse signal output by synthesizing the main pulse and ancillary pulse. figure 13-1. block diagram of pwm unit internal bus 16 15 8 7 0 modulo h register n modulo l register n 8 prescaler f pwmc 8 selector reload control pwm control register n (pwmcn) ancillary pulse generator/ output controller main pulse generator/output controller pulse synthesizer/ output controller pwmn main pulse ancillary pulse 2 x /f pwmc 2 x +8 /f pwmc f x /4 pwmen pmpn2 pmpn1 pmpn0 alvn synn ckspn1 ckspn0 x remarks 1. n = 0, 1 x = 4 to 8 (specified by pmpn2 to pmpn0 bits) 2. f pwmc : pwm operating clock f x : main clock
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 769 13.3 control registers (1) pwm control registers 0 and 1 (pwmc0 and pwmc1) pwmcn is a register that controls pwmn (n = 0, 1). these registers can be read or written in 8-bit or 1-bit units. cautions 1. do not change the setting of the pmpn2 to pmpn0, synn, ckspn1, and ckspn0 bits during pwm operation (when pwmen bit = 1). otherwise, the operation cannot be guaranteed. 2. note that, if the setting of the alvn bit is changed during pwm operation (when pwmen bit = 1), noise may be generated.
chapter 13 pwm unit preliminary user?s manual u16031ej2v1ud 770 7 pwme0 pwme1 pwmc0 pwmc1 6 pmp02 pmp12 5 pmp01 pmp11 4 pmp00 pmp10 3 alv0 alv1 2 syn0 syn1 cksp01 cksp11 cksp00 cksp10 address fffffb00h fffffb10h 0 1 after reset 08h 08h bit position bit name function 7 pwmen this bit enables or disables the operation of pwmn. 0: disables pwm operation. outputs the inactive level as pwm output (pwmn). 1: enables pwm operation. these bits specify the number of main pulse length specification bits and the main pulse length. pmpn2 pmpn1 pmpn0 number of main pulse length specification bits main pulse bit length 0008 bits 2 8 (256 bits) 0017 bits 2 7 (128 bits) 0106 bits 2 6 (64 bits) 0115 bits 2 5 (32 bits) 1004 bits 2 4 (16 bits) other than above setting prohibited 6 to 4 pmpn2 to pmpn0 3 alvn this bit specifies the active level of pwmn. 0: active low 1: active high at reset, the inactive level of the alvn bit (low level) is output as pwm output. 2 synn this bit specifies the period during which the pulse width of pwmn is to be rewritten. 0: long period (every 256 pwm cycles (2 x+8 /f pwmc )) 1: short period (every 1 pwm cycle (2 x /f pwmc )) these bits specify the operating clock of pwmn (f pwmc ). ckspn1 ckspn0 operating clock (f pwmc ) 00f x /4 01f x /8 10f x /16 11f x /32 1, 0 ckspn1, ckspn0 remarks 1. n = 0, 1 x = 4 to 8 (specified by pmpn2 to pmpn0 bits) 2. f x : main clock
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 771 (2) pwm modulo registers 0 and 1 (pwm0 and pwm1) these 16-bit registers determine the pulse width of the pwm pulse. these registers can be read or written in 16-bit units. if the higher 8 bits of the pwmn register are used as a pwmhn register and the lower 8 bits are used as a pwmln register, these registers can be read or written in 8-bit units. <1> modulo h register n (pwmhn): bits 15 to 8 this register specifies the active level of the main pulse. the data of the active level width of only the bit length specified by the pmpn2 to pmpn0 bits of the pwmcn register is valid. if the counter length is set to 4 to 7 bits by the pmpn2 to pmpn0 bits, data input to the higher bits is invalid. <2> modulo l register n (pwmln): bits 7 to 0 this register adjusts the timing of the ancillary pulse for fine tuning (see figure 13-2 ). a value of 0000h to ffffh can be set to the pwmn register, and the pwm output changed linearly. if a value of 0000h is set, the inactive level is held. if the value is ffffh, the pwm output becomes inactive for one ancillary pulse (1/f pwmc ) in one rewrite cycle (2 16 /f pwmc ) (see figure 13-3 ). after reset 0000h 15 14 13 12 11 modulo h register n (for generating main pulse) 109876543210 pwmn address pwm0: fffffb02h pwm1: fffffb12h modulo l register n (for generating ancillary pulse)
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 772 13.4 operation 13.4.1 pwm basic operation pwmn is divided into 256 parts, each of which is called a main pulse. each main pulse has 4- to 8-bit accuracy. pwmn realizes a signal with an accuracy of 12 to 16 bits by synthesizing the required number of main pulses and an ancillary pulse with a pulse width of one clock. the main pulse is set by the pmpn2 to pmpn0 bits of pwm control register n (pwmcn), and the pulse width is determined by the value of modulo h register n (valid number of bits). the repeat cycle of the pwm pulse output is the operating clock cycle (f pwmc ) of pwmn specified by the ckspn1 and ckspn0 bits of the pwmcn register divided by 2 x (f pwmc /2 x ). of the 256 main pulses, the ancillary pulses are generated only for the main pulses of the set number specified by modulo l register n. the pulse width is 1/f pwmc . the logical sum of the main pulse and the ancillary pulse is output as the pwm pulse signal. therefore, the average value of 256 pwm pulse signals is the pwm pulse signal with a resolution of 12 to 16 bits. the duty factor of the output pwm pulse is determined as follows, by the value set to modulo h register n of pwm modulo register n (pwm0 or pwm1). (1) if ancillary pulse is not generated 2 n) register h modulo of (value pulse pwm output of duty x = (2) if ancillary pulse is generated 2 1 n) register h modulo of (value pulse pwm output of duty x + = remark x = 4 to 8 (bit length of main pulse)
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 773 figure 13-2. example of pwm output with main pulse and ancillary pulse 0 1 2 3 4 5 6 7 8 9 10 11 12 13 254 255 main pulse pwmn = xx40h ancillary pulse (modulo l = 40h) ancillary pulse (modulo l = c0h) pw m output main pulse pw m output 1/f pwmc t x 1/f pwmc 2 x 1/f pwmc 16-bit accuracy when 256 output pulses are averaged pwmn = xxc0h remarks 1. n = 0, 1 2. f pwmc : pwm operating clock tx: value of modulo h register n x: number of valid bits of modulo h register n (specified by pmpn2 to pmpn0 bits of pwmcn register) active level: high
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 774 figure 13-3. example of pwm output operation l 0123 456 78 ... 126 127 128 ... 254 255 l l l l main pulse pwmn = 0000h ancillary pulse (modulo l = 00h) ancillary pulse (modulo l = 01h) pw m output main pulse pw m output ancillary pulse (modulo l = 00h) main pulse pw m output 16-bit accuracy when 256 output pulses are averaged pwmn = 0001h pwmn = ff00h ancillary pulse (modulo l = ffh) main pulse pw m output pwmn = ffffh remarks 1. n = 0, 1 2. condition: number of valid bits of modulo h register n = 8 16-bit accuracy active level: high
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 775 13.4.2 starting/stopping pwm operation to output a pwm pulse, set data to pwm modulo register n (pwmn) and then set the pwmen bit of pwm control register n (pwmcn) to 1 (n = 0, 1). as a result, the pwm output pin outputs a pwm pulse of the active level specified by the alvn bit of the pwmcn register. when the pwmen bit of the pwmcn register is cleared to 0, the pwm output unit immediately stops the pwm output operation, and the pwm output pin becomes inactive. (1) setting for starting pwm operation before starting the operation of pwmn (when pwmen bit of pwmcn register = 0), be sure to initialize the following registers. ? pmcdh, pfcdh registers: set the control mode. ? pwmn register: set the pulse width. ? pwmcn register: ckspn1 and ckspn0 bits: specify the operating clock (f pwmc ) (f x /4, f x /8, f x /16, f x /32) pmpn2 to pmpn0 bits: specify the bit length (x) of the main pulse. alvn bit: specify the active level of the pwm pulse. synn bit: specify the pwm pulse width rewrite period. cautions 1. do not change the setting of the pmpn2 to pmpn0, synn, ckspn1, and ckspn0 bits when pwmen bit of the pwmcn register = 1. otherwise, the operation cannot be guaranteed. 2. note that, if the setting of the alvn bit is changed during pwm operation (when pwmen bit = 1), noise may be generated. remark n = 0, 1 when the pwmen bit of the pwmcn register is set, pwmn starts operating. immediately after pwmn has started operating, however, the pwm pin maintains the status of the port mode (inactive level) until the reload signal of the pwmn register is generated. after the operation has been started, the pwm output becomes active when the reload signal is generated, regardless of the setting of the synn bit (pwmn = other than 00xxh). if the timing of rewriting the pulse width is set to 2 x+8 (long period: synn bit = 0), the operation is started up to 2 x+8 /f pwmc after the pwmen bit has been set. the pwmn register can be rewritten even during pwm output.
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 776 (2) setting for stopping pwm operation when the pwmen bit of the pwmcn register (n = 0, 1) is cleared to 0, the pwm operation is immediately stopped, and the pwm output becomes inactive immediately. figure 13-4. pwm operation timing pwmn operation starts (pwmen = 1) operation setting 2 x /f pwmc 2 x /f pwmc 2 x /f pwmc pw m output reload signal pwmen bit pwmn operation stops (pwmen = 0) remarks 1. n = 0, 1 x = 4 to 8 (specified by pmpn2 to pmpn0 bits of pwmcn register) 2. f pwmc : pwm operating clock
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 777 13.4.3 setting active level of pwm pulse the alvn bit of pwm control register n (pwmcn) specifies the active level of the pwm pulse output from the pwm output pin (n = 0, 1). if the alvn bit is set to 1, an active-high pulse is output; if it is cleared to 0, an active-low pulse is output. if the alvn bit is rewritten, the active level of pwm output is immediately changed. the figure below shows the setting of the active level of pwm output and pin status. regardless of the setting of the pwmen bit (which enables or disables pwm), the active level of pwm output can be changed by manipulating the alvn bit. figure 13-5. setting active level of pwm output alvn pwmn (active-high) (active-low) (rewriting alvn bit) remark n = 0, 1
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 778 13.4.4 specifying pwm pulse width rewrite period pwm output is started and the pulse width is changed every 256 cycles of the pwm pulse (2 x+8 /f pwmc ) or every one pwm cycle (2 x /f pwmc ). this pwm pulse width rewrite period is specified by the synn bit of the pwmcn register (n = 0, 1). when the synn bit is cleared to 0, the pulse width is changed every 256 pwm pulse cycles (2 x+8 /f pwmc ) (long period). therefore, it takes up to 2 x+8 clocks to output a pulse of the width corresponding to the data written to the pwmn register. an example of the pwm output timing at this time is shown in figure 13-6. when the synn bit is set to 1, the pulse width is changed every one pwm pulse cycle (2 x /f pwmc ) (short period). in this case, it takes up to 2 x clocks to output a pulse of the width corresponding to the data written to the pwmn register. if the pwm pulse rewrite period is specified to be every 2 x /f pwmc (if the synn bit is set to 1), the accuracy of the pwm pulse is x bits or more and (x+8) bits or less, or is lower than the accuracy when the rewrite cycle is set to 2 x+8 /f pwmc . however, the response speed improves because the repeat cycle increases. figure 13-7 shows an example of the pwm output timing where the rewrite timing is 2 x /f pwmc . figure 13-6. pwm output timing example 1 (pwm pulse width rewrite period: 2 x+8 /f pwmc ) pwmn output pin contents of pwmn register pwm pulse width rewriting timing rewriting pwmn register pwm pulse width rewriting timing pwm pulse width rewriting timing pwm pulse 2 x+8 cycles pwm pulse 2 x+8 cycles pwm output enabled (pwmen = 1) m l cautions 1. the pulse width is rewritten every 256 cycles of the pwm pulse 2. the accuracy of the pwm pulse is (x+8) bits. remark n = 0, 1
chapter 13 pwm unit preliminary user ? s manual u16031ej2v1ud 779 figure 13-7. pwm output timing example 2 (pwm pulse width rewrite period: 2 x /f pwmc ) 1 pwm pulse cycle pwmn output pin contents of pwmn register pwm output enabled (pwmen = 1) rewriting pwmn register rewriting pwmn register pwm pulse width changing timing rewriting pwmn register m kl m cautions 1. the pulse width is rewritten every one pwm pulse cycle. 2. the accuracy of the pwm pulse is x bits or more and (x+8) bits or less. remarks 1. k, l, and m indicate the contents of the pwmn register. 2. n = 0, 1 13.4.5 repeat cycle the following table shows the repeat cycle of pwmn (n = 0, 1). table 13-1. repeat cycle of pwmn pulse width rewrite period main pulse accuracy ancillary pulse accuracy repeat cycle long period (synn bit = 0) short period (synn bit = 1) 4 bits 8 bits 16/f pwmc 2 12 /f pwmc 2 4 /f pwmc 5 bits 8 bits 32/f pwmc 2 13 /f pwmc 2 5 /f pwmc 6 bits 8 bits 64/f pwmc 2 14 /f pwmc 2 6 /f pwmc 7 bits 8 bits 128/f pwmc 2 15 /f pwmc 2 7 /f pwmc 8 bits 8 bits 256/f pwmc 2 16 /f pwmc 2 8 /f pwmc remarks 1. n = 0, 1 2. f pwmc : pwm operating clock
preliminary user?s manual u16031ej2v1ud 780 chapter 14 port functions 14.1 features ? input-only ports: 1 i/o ports: 77 ? function alternately as other peripheral i/o pins. ? it is possible to specify input and output in 1-bit units. 14.2 port configuration the v850e/me2 incorporates a total of 78 input/output ports (including 1 input-only port) labeled ports 1, 2, 5 to 7, al, ah, dh, cs, ct, cm, and cd. the port configuration is shown below. port 1 p10 p13 port 2 p21 p25 p20 port 5 p50 p55 port 6 p65 p67 port 7 p72 p77 port al port ah pal0 pal1 pah0 pah9 port dh port cs port ct port cm pdh0 pdh15 pcs0 pcs7 pct0 pct5 pct7 pcm0 pcm5 port cd pcd0 pcd3
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 781 (1) function of each port the port functions of this product are shown below. 8-bit and 1-bit operations are possible on all ports, allowing various kinds of control to be performed. in addition to their port functions, these pins also function as on-chip peripheral i/o input/output pins in the control mode. for the block types of each port, see (3) block diagram of port . port name pin name port function function in control mode block type port 1 p10 to p13 4-bit i/o serial interface i/o (csi30, uartb0) external interrupt input usb clock signal input f-1, f-3, h-1, j-1 port 2 p20 to p25 1-bit input, 5-bit i/o nmi input serial interface i/o (csi31, uartb1) external interrupt input a-1, f-4, g-2, h-1 port 5 p50 to p55 6-bit i/o dma controller i/o external interrupt input real-time pulse unit (rpu) i/o f-2, f-3, g-1, g-2, j-1 port 6 p65 to p67 3-bit i/o real-time pulse unit (rpu) i/o external interrupt input l-3, l-5 port 7 p72 to p77 6-bit i/o dma controller i/o real-time pulse unit (rpu) i/o external interrupt input l-1, l-2, l-4 port al pal0, pal1 2-bit i/o external address bus (a0, a1) external interrupt input g-3 port ah pah0 to pah9 10-bit input external address bus (a16 to a25) d-2 port dh pdh0 to pdh15 16-bit i/o external data bus (d16 to d31) external interrupt input pwm output real-time pulse unit (rpu) i/o m-1, m-2, m-3 port cs pcs0 to pcs7 8-bit i/o external bus interface control signal output d-2, j-2 port ct pct0 to pct5, pct7 7-bit i/o external bus interface control signal output d-2, j-3 port cm pcm0 to pcm5 6-bit i/o wait insertion signal input external bus interface control signal i/o self-refresh request signal input a/d converter external trigger input c-1, d-1, d-2, f-5 port cd pcd0 to pcd3 4-bit i/o external bus interface control signal output bus clock output d-1, d-2
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 782 cautions 1. when switching the mode of a port that functions as an output or i/o pin to control mode, be sure to follow the procedure below. <1> set the inactive level of the signals output in control mode to the appropriate bits in port n (n = 1, 2, 5 to 7, al, ah, dh, cs, ct, cm, and cd). <2> the mode is switched to control mode by the port n mode control register (pmcn). if <1> above is not performed, the contents of port n may be output for a moment when the mode is switched from port mode to control mode. 2. to manipulate a port by using a bit manipulation instruction (set1, clr1, or not1), read the port in byte units, process the data of only the bit to be manipulated, and then write back the byte data to the port after conversion. in the case of a port having a mixture of input and output pins, the contents of the output latch are written over bits other than the bit to be manipulated. consequently, the output latch of the input pin is undefined (in the input mode, however, the pin status does not change because the output buffer is turned off). to change the port mode from the input to the output mode, therefore, set an expected output value to the corresponding bits, and then change the mode to the output mode. the same applies to a port that has both a control mode and an output mode.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 783 (2) function when each port?s pins are reset and registers that set the port/control mode (1/2) port name pin name pin function after reset register that sets the mode p10/intp10/uclk p10 (input mode) p11/intp11/sck0 p11 (input mode) p12/si0/rxd0 p12 (input mode) port 1 p13/so0/txd0 p13 (input mode) pmc1, pfc1 p20/nmi nmi ? p21/intp21/rxd1 p21 (input mode) p22/intp22/txd1 p22 (input mode) p23/intp23/sck1 p23 (input mode) p24/intp24/si1 p24 (input mode) port 2 p25/intp25/so1 p25 (input mode) pmc2, pfc2 p50/intp50/dmarq0 p50 (input mode) p51/intp51/dmaak0 p51 (input mode) p52/intp52/tc0 p52 (input mode) p53/intpc00/tic0/dmarq1 p53 (input mode) p54/intpc01/dmaak1 p54 (input mode) port 5 p55/toc0/tc1 p55 (input mode) pmc5, pfc5 p65/intp65/intpc10/tic1 p65 (input mode) p66/intp66/intpc11 p66 (input mode) port 6 p67/intp67/toc1 p67 (input mode) pmc6, pfc6 p72/intpc20/tic2/dmarq2 p72 (input mode) p73/intpc21/dmaak2 p73 (input mode) p74/toc2/tc2 p74 (input mode) p75/intpc30/tic3/dmarq3 p75 (input mode) p76/intpc31/dmaak3 p76 (input mode) port 7 p77/toc3/tc3 p77 (input mode) pmc7, pfc7 pal0/intpl0/a0 pal0 (input mode) intpl0/a0 port al pal1/intpl1/a1 pal1 (input mode) intpl1/a1 pmcal, pfcall port ah pah0/a16 to pah9/a25 pah0 to pah9 (input mode) a16 to a25 pmcah pcs0/cs0 pcs0 (input mode) cs0 pcs1/cs1 pcs1 (input mode) cs1 pmccs pcs2/cs2/iowr pcs2 (input mode) cs2/iowr pmccs, pfccs pcs3/cs3 pcs3 (input mode) cs3 pcs4/cs4 pcs4 (input mode) cs4 pmccs pcs5/cs5/iord pcs5 (input mode) cs5/iord pmccs, pfccs pcs6/cs6 pcs6 (input mode) cs6 port cs pcs7/cs7 pcs7 (input mode) cs7 pmccs
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 784 (2/2) port name pin name pin function after reset register that sets the mode pct0/llwr/llbe/lldqm pct0 (input mode) llwr/llbe/lldqm pct1/luwr/lube/ludqm pct1 (input mode) luwr/lube/ludqm pct2/ulwr/ulbe/uldqm pct2 (input mode) ulwr/ulbe/uldqm pct3/uuwr/uube/uudqm pct3 (i nput mode) uuwr/uube/ uudqm pmcct, pfcct pct4/rd pct4 (input mode) rd pct5/we/wr pct5 (input mode) we/wr port ct pct7/bcyst pct7 (input mode) bcyst pmcct pcm0/wait pcm0 (input mode) wait pmccm pcm1 pcm1 (input mode) ?? pcm2/hldak pcm2 (input mode) hldak pcm3/hldrq pcm3 (input mode) hldrq pcm4/refrq pcm4 (input mode) refrq pmccm port cm pcm5/selfref/adtrg pcm5 (input mode) selfref/adtrg pmccm, pfccm pcd0/sdcke pcd0 (input mode) sdcke pcd1/busclk pcd1 (input mode) busclk pcd2/sdcas pcd2 (input mode) sdcas port cd pcd3/sdras pcd3 (input mode) sdras pmccd pdh0/d16/intpd0 pdh0 (input mode) d16/intpd0 pdh1/d17/intpd1 pdh1 (input mode) d17/intpd1 pmcdh pdh2/d18/intpd2/toc4 pdh2 (input mode) d18/intpd2/toc4 pmcdh, pfcdh pdh3/d19/intpd3 pdh3 (input mode) d19/intpd3 pdh4/d20/intpd4 pdh4 (input mode) d20/intpd4 pmcdh pdh5/d21/intpd5/toc5 pdh5 (input mode) d21/intpd5/toc5 pdh6/d22/intpd6/intp100/tcud10 pdh6 (input mode) d22/intpd6/intp100/tcud10 pdh7/d23/intpd7/intp101/tclr10 pdh7 (input mode) d23/intpd7/intp101/tclr10 pdh8/d24/intpd8/to10 pdh8 (input mode) d24/intpd8/to10 pdh9/d25/intpd9/tiud10 pdh9 (input mode) d25/intpd9/tiud10 pdh10/d26/intpd10/intp110/tcud11 pdh10 (input mode) d26/intpd10/intp110/tcud11 pdh11/d27/intpd11/intp111/tclr11 pdh11 (input mode) d27/intpd11/intp111/tclr11 pdh12/d28/intpd12/to11 pdh12 (input mode) d28/intpd12/to11 pdh13/d29/intpd13/tiud11 pdh13 (input mode) d29/intpd13/tiud11 pdh14/d30/intpd14/pwm0 pdh14 (input mode) d30/intpd14/pwm0 port dh pdh15/d31/intpd15/pwm1 pdh15 (input mode) d31/intpd15/pwm1 pmcdh, pfcdh
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 785 (3) block diagram of port figure 14-1. block diagram of type a-1 internal bus wr intr rd address p20 nmir0 selector wr intf nmif0 0 1 a noise elimination edge detection nmi remark a: masked in cycles other than read cycles
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 786 figure 14-2. block diagram of type c-1 internal bus wr pmc rd address wr port a b c pcmn pmccmn pcmn selector selector wr pm pmcmn input signal in control mode remarks 1. n = 0, 3 2. a: active in output port mode b: active in read cycle of port mode or in control mode c: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 787 figure 14-3. block diagram of type d-1 internal bus wr pmc rd address wr port pmn b a pmcmn pmn selector selector selector wr pm pmmn output signal in control mode remarks 1. mn = cm1, cd1 2. a: active in output port mode or control mode b: masked in cycles other than read cycles
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 788 figure 14-4. block diagram of type d-2 internal bus wr pmc rd address output signal in control mode output buffer off signal note wr port pmn b a pmcmn pmn selector selector selector wr pm pmmn note pah0 to pah9: these signals become active in the idle mode and software stop mode, and by bus hold and reset. pcs0, pcs1, pcs3, pcs4, pcs6, pcs7, pcd2, pcd3, pct4, pct5, pct7: these signals become active by bus hold and reset. pcm2, pcm4, pcd0: these signals become active at reset. remarks 1. mn = ah0 to ah9, cs0, cs1, cs3, cs4, cs6, cs7, ct4, ct5, ct7, cm2, cm4, cd0, cd2, cd3 2. a: active in output port mode or control mode b: masked in cycles other than read cycles
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 789 figure 14-5. block diagram of type f-1 wr pmc rd address wr port p pmc12 p12 wr pfc pfc12 wr pm pm12 internal bus wr pmc rd wr port p12 selector selector wr pm selector a b c input signal in control mode remark a: active in output port mode b: active in read cycle of port mode or in control mode c: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 790 figure 14-6. block diagram of type f-2 wr pmc rd address wr port p pmc53 p53 wr pfc pfc53 wr pm pm53 internal bus wr pmc rd wr port p53 selector selector wr pm selector a b c input signal in control mode remark a: active in output port mode b: active in read cycle of port mode or in control mode c: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 791 figure 14-7. block diagram of type f-3 internal bus wr pmc rd noise elimination edge detection address input signal in control mode wr port pmn c b a pmcmn wr pfc pfcmn selector selector selector wr intr intrmn wr pm pmmn pmn wr intf intfmn remarks 1. mn = 10, 50 2. a: active in output port mode b: active in read cycle of port mode or in control mode c: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 792 figure 14-8. block diagram of type f-4 internal bus wr pmc rd noise elimination edge detection address input signal in control mode wr port p2n c b a pmc2n wr pfc pfc2n selector selector selector wr intr intr2n wr pm pm2n p2n wr intf intf2n remarks 1. n = 1, 4 2. a: active in output port mode b: active in read cycle of port mode or in control mode c: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 793 figure 14-9. block diagram of type f-5 internal bus wr pmc rd address wr port pmccm5 wr pfc pfccm5 selector selector selector wr pm pmcm5 pcm5 pcm5 input signal in control mode a b c remark a: active in output port mode b: active in read cycle of port mode or in control mode c: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 794 figure 14-10. block diagram of type g-1 internal bus wr pmc rd address wr port pmc54 p54 selector selector selector wr pfc pfc54 wr pm pm54 output signal in control mode input signal in control mode a b c d p54 remark a: active in output control mode b: active in output port mode c: active in read cycle of port mode or in input control mode d: masked in port mode or output control mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 795 figure 14-11. block diagram of type g-2 internal bus wr pmc rd noise elimination edge detection address output signal in control mode input signal in control mode wr port pmn d c b pmcmn wr pfc pfcmn selector selector selector wr intr intrmn wr pm pmmn pmn wr intf intfmn a remarks 1. mn = 22, 25, 51, 52 2. a: active in output control mode b: active in output port mode c: active in read cycle of port mode or in input control mode d: masked in port mode or output control mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 796 figure 14-12. block diagram of type g-3 internal bus wr pmc rd noise elimination edge detection address output signal in control mode input signal in control mode wr port paln d c b pmcmn wr pfc pfcmn selector selector selector wr intr intrmn wr pm pmmn pmn wr intf intfmn a output buffer off signal note note signal that becomes active in idle mode and software stop mode, and by bus hold and reset remarks 1. n = 0, 1 2. a: active in output control mode b: active in output port mode c: active in read cycle of port mode or in input control mode d: masked in port mode or output control mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 797 figure 14-13. block diagram of type h-1 internal bus wr pmc rd noise elimination edge detection address output signal in control mode output enable signal in control mode input signal in control mode wr port pmn d c b pmcmn wr pfc pfcmn selector selector selector selector wr intr intrmn wr pm pmmn pmn wr intf intfmn a remarks 1. mn = 11, 23 2. a: active in output port mode b: bidirectional control mode (dir control): active in output direction c: active in read cycle of port mode or in input control mode d: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 798 figure 14-14. block diagram of type j-1 internal bus wr pmc wr pfc rd address output signal in control mode wr port pmn b a pmcmn pfcmn pmn selector selector selector selector wr pm pmmn remarks 1. mn = 13, 55 2. a: active in output port mode or control mode b: masked in cycles other than read cycles
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 799 figure 14-15. block diagram of type j-2 internal bus wr pmc wr pfc rd address output signal in control mode output buffer off signal note wr port pcsn b a pmccsn pfccsn pcsn selector selector selector selector wr pm pmcsn note signal that becomes active by bus hold and reset remarks 1. n = 2, 5 2. a: active in output port mode or control mode b: masked in cycles other than read cycles
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 800 figure 14-16. block diagram of type j-3 internal bus wr pmc wr pfc rd address output signal in control mode output buffer off signal note wr port pctn b a pmcctn pfcctn pctn selector selector selector selector wr pm pmctn note signal that becomes active by bus hold and reset remarks 1. n = 0 to 3 2. a: active in output port mode or control mode b: masked in cycles other than read cycles
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 801 figure 14-17. block diagram of type l-1 internal bus wr pm rd address wr port pm7n p7n selector selector selector selector wr pfc pfc7n wr pmc pmc7n output signal in control mode a b p7n remarks 1. n = 4, 7 2. a: active in output port mode or control mode b: masked in cycles other than read cycles
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 802 figure 14-18. block diagram of type l-2 internal bus wr pfc rd address wr port pfc7n p7n selector selector selector wr pm pm7n wr pmc pmc7n p7n a output signal in control mode input signal in control mode b c remarks 1. n = 3, 6 2. a: active in output control mode b: active in output port mode c: masked in port mode or output control mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 803 figure 14-19. block diagram of type l-3 internal bus wr pmc rd noise elimination edge detection address output signal in control mode input signal in control mode wr port p67 c b a pmc67 wr pfc pfc67 selector selector selector wr intr intr67 wr pm pm67 p67 wr intf intf67 remark a: active in output control mode b: active in output port mode c: masked in port mode or output control mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 804 figure 14-20. block diagram of type l-4 internal bus wr pmc rd address input signal in control mode wr port p7n pmc7n p7n b selector selector selector wr pfc pfc7n wr pm pm7n a remarks 1. n = 2, 5 2. a: active in output port mode b: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 805 figure 14-21. block diagram of type l-5 internal bus wr pmc rd noise elimination edge detection address input signal in control mode wr port p6n b a pmc6n wr pfc pfc6n selector selector selector wr intr intr6n wr pm pm6n p6n wr intf intf6n remarks 1. n = 5, 6 2. a: active in output port mode b: masked in port mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 806 figure 14-22. block diagram of type m-1 internal bus wr pmc rd noise elimination edge detection address output signal in 32-bit mode 32-bit mode select signal input signal in 32-bit mode output enable signal in 32-bit mode 32-bit mode select signal output enable signal in 32-bit mode output buffer off signal note input signal in control mode wr port pdhn c b a pmcdhn selector selector selector wr intr intrdhn wr pm pmdhn pdhn wr intf intfdhn note signal that becomes active in idle mode and software stop mode, and by bus hold and reset remarks 1. n = 0, 1, 3, 4 2. a: active in output port mode b: active in read cycle of port mode, or in control mode or 32-bit mode c: masked in port mode or 32-bit mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 807 figure 14-23. block diagram of type m-2 internal bus wr pmc rd noise elimination edge detection address output signal in control mode output signal in 32-bit mode 32-bit mode select signal input signal in 32-bit mode output enable signal in 32-bit mode select signal in 32-bit mode output enable signal in 32-bit mode output buffer off signal note input signal in control mode wr port pdhn d c b a pmcdhn wr pfc pfcdhn selector selector selector selector wr intr intrdhn wr pm pmdhn pdhn wr intf intfdhn note signal that becomes active in idle mode and software stop mode, and by bus hold and reset remarks 1. n = 2, 5, 8, 12, 14, 15 2. a: active in output control mode b: active in output port mode c: active in read cycle of port mode, or in input control mode or 32-bit mode d: masked in port mode, input control mode, or 32-bit mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 808 figure 14-24. block diagram of type m-3 internal bus wr pmc rd noise elimination edge detection address output signal in control mode output signal in 32-bit mode 32-bit mode select signal input signal in 32-bit mode output enable signal in 32-bit mode output signal in 32-bit mode output enable signal in 32-bit mode output buffer off signal note input signal in control mode wr port pdhn c b a pmcmn wr pfc pfcdhn selector selector selector selector selector wr intr intrdhn wr pm pmmn pmn wr intf intfdhn note signal that becomes active in idle mode and software stop mode, and by bus hold and reset remarks 1. n = 6, 7, 9, 10, 11, 13 2. a: active in output port mode b: active in read cycle of port mode, or in control mode or 32-bit mode c: masked in port mode or 32-bit mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 809 14.3 port pin functions 14.3.1 port 1 port 1 is a 4-bit i/o port that can be set to the input or output mode in 1-bit units. 7 0 p1 6 0 5 0 4 0 3 p13 2 p12 1 p11 0 p10 address fffff402h after reset undefined bit position bit name function 3 to 0 p1n (n = 3 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their function as port pins, the port 1 pins can also operate as serial interface i/o (csi30, uartb0), usb clock signal input, and external interrupt request input in the control mode. (1) operation in control mode port alternate function remark block type p10 intp10/uclk external interrupt input/usb clock signal input f-3 p11 intp11/sck0 external interrupt request input/ serial interface (csi30) i/o h-1 p12 si0/rxd0 f-1 port 1 p13 so0/txd0 serial interface (csi30) i/o/ serial interface (uartb0) i/o j-1
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 810 (2) i/o mode/control mode setting the port 1 i/o mode setting is performed by the port 1 mode register (pm1), and the control mode setting is performed by the port 1 mode control register (pmc1) and port 1 function control register (pfc1). (a) port 1 mode register (pm1) this register can be read or written in 8-bit or 1-bit units. 7 1 pm1 6 1 5 1 4 1 3 pm13 2 pm12 1 pm11 0 pm10 address fffff422h after reset ffh bit position bit name function 3 to 0 pm1n (n = 3 to 0) specifies input/output mode for p1n pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port 1 mode control register (pmc1) this register can be read or written in 8-bit or 1-bit units. 7 0 pmc1 6 0 5 0 4 0 3 pmc13 2 pmc12 1 pmc11 0 pmc10 address fffff442h after reset 00h bit position bit name function 3 pmc13 specifies operation mode of p13 pin in combination with the pfc1 register. 0: i/o port mode 1: so0 output mode/txd0 output mode 2 pmc12 specifies operation mode of p12 pin in combination with the pfc1 register. 0: i/o port mode 1: si0 input mode/rxd0 input mode 1pmc11 specifies operation mode of p11 pin in combination with the pfc1 register. 0: i/o port mode 1: external interrupt request (intp11) input mode/sck0 i/o mode 0 pmc10 specifies operation mode of p10 pin in combination with the pfc1 register. 0: i/o port mode 1: external interrupt request (intp10) input mode/uclk input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 811 (c) port 1 function control register (pfc1) this register can be read or written in 8-bit or 1-bit units. caution when the port mode is specified by the port 1 mode control register (pmc1), the setting of this register becomes invalid. 7 0 pfc1 6 0 5 0 4 0 3 pfc13 2 pfc12 1 pfc11 0 pfc10 address fffff462h after reset 00h bit position bit name function 3 pfc13 specifies operation mode of p13 pin in control mode. 0: so0 output mode 1: txd0 output mode 2 pfc12 specifies operation mode of p12 pin in control mode. 0: si0 input mode 1: rxd0 input mode 1 pfc11 specifies operation mode of p11 pin in control mode. 0: external interrupt request (intp11) input mode 1: sck0 i/o mode 0 pfc10 specifies operation mode of p10 pin in control mode. 0: external interrupt request (inpt10) input mode 1: uclk input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 812 (3) selecting interrupt trigger mode the valid edges of the intp10 and intp11 pins can be selected by program. the levels to be detected can also be selected. external interrupt rising edge specification register 1 (intr1) and external interrupt falling edge specification register 1 (intf1) are used to specify the valid edge and level detection. (a) external interrupt rising edge specification register 1 (intr1) and external interrupt falling edge specification register 1 (intf1) these registers are used to specify the trigger mode of the external interrupt requests (intp10 and intp11) from external pins. the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intf10 and intr10 bits: intp10 ? intf11 and intr11 bits: intp11 the valid edge can be independently selected from the rising edge, falling edge, and both rising and falling edges. both the registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode of the intp10 and intp11 pins, set the pmc1 register. if the pmc1 register is set after the intr1 and intf1 registers have been set, an illegal interrupt may occur when the pmc1 register is set.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 813 7 0 intr1 6 0 5 0 4 0 3 0 2 0 1 intr11 0 intr10 address fffffc22h after reset 03h 0 intf1 00000 intf11 intf10 fffffc02h 00h bit position bit name function specify trigger mode of intp10 and intp11 pins. intf1n intr1n operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 1, 0 intf1n, intr1n (n = 0, 1) notes 1. the level of the intp1n pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the p1ifn bit (n = 0, 1). consequently, even when the cpu acknowledges the interrupt and the p1ifn bit of the interrupt control register (p1icn) is automatically cleared to 0, the p1ifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intp1n pin of the external device inactive in the interrupt servicing routine, and forcibly clear the p1ifn bit to 0. 2. if a level-detected interrupt request (intp1n) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intp1n) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intp1n) is held pending (n = 0, 1). to not acknowledge the interrupt request of intp1n, clear the p1ifn bit of the interrupt control register.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 814 14.3.2 port 2 port 2 is an i/o port that can be set to the input or output mode in 1-bit units except for p20, which is an input-only pin. 7 0 p2 6 0 5 p25 4 p24 3 p23 2 p22 1 p21 0 p20 address fffff404h after reset undefined bit position bit name function 5 to 0 p2n (n = 5 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their function as port pins, the port 2 pins can also operate as the serial interface (csi31, uartb1) i/o and external interrupt request input in the control mode. (1) operation in control mode port alternate function remark block type p20 nmi non-maskable interrupt request input a-1 p21 intp21/rxd1 f-4 p22 intp22/txd1 external interrupt request input/ serial interface (uartb1) i/o g-2 p23 intp23/sck1 h-1 p24 intp24/si1 f-4 port 2 p25 intp25/so1 external interrupt request input/ serial interface (csi31) i/o g-2
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 815 (2) i/o mode/control mode setting the port 2 i/o mode setting is performed by the port 2 mode register (pm2), and the control mode setting is performed by the port 2 mode control register (pmc2) and the port 2 function control register (pfc2). (a) port 2 mode register (pm2) this register can be read or written in 8-bit or 1-bit units. 7 1 pm2 6 1 5 pm25 4 pm24 3 pm23 2 pm22 1 pm21 0 1 address fffff424h after reset ffh bit position bit name function 5 to 1 pm2n (n = 5 to 1) specifies input/output mode for p2n pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port 2 mode control register (pmc2) this register can be read or written in 8-bit or 1-bit units. 7 0 pmc2 6 0 5 pmc25 4 pmc24 3 pmc23 2 pmc22 1 pmc21 0 1 address fffff444h after reset 01h bit position bit name function 5 pmc25 specifies operation mode of p25 pin in combination with the pfc2 register. 0: i/o port mode 1: external interrupt request (intp25) input mode/so1 output mode 4 pmc24 specifies operation mode of p24 pin in combination with the pfc2 register. 0: i/o port mode 1: external interrupt request (intp24) input mode/si1 input mode 3pmc23 specifies operation mode of p23 pin in combination with the pfc2 register. 0: i/o port mode 1: external interrupt request (intp23) input mode/sck1 i/o mode 2 pmc22 specifies operation mode of p22 pin in combination with the pfc2 register. 0: i/o port mode 1: external interrupt request (intp22) input mode/txd1 output mode 1pmc21 specifies operation mode of p21 pin in combination with the pfc2 register. 0: i/o port mode 1: external interrupt request (intp21) input mode/rxd1 input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 816 (c) port 2 function control register (pfc2) this register can be read or written in 8-bit or 1-bit units. caution when the port mode is specified by the port 2 mode control register (pmc2), the pfc2 setting becomes invalid. 7 0 pfc2 6 0 5 pfc25 4 pfc24 3 pfc23 2 pfc22 1 pfc21 0 0 address fffff464h after reset 00h bit position bit name function 5 pfc25 specifies operation mode of p25 pin in control mode. 0: external interrupt request (intp25) input mode 1: so1 output mode 4 pfc24 specifies operation mode of p24 pin in control mode. 0: external interrupt request (intp24) input mode 1: si1 input mode 3 pfc23 specifies operation mode of p23 pin in control mode. 0: external interrupt request (intp23) input mode 1: sck1 i/o mode 2 pfc22 specifies operation mode of p22 pin in control mode. 0: external interrupt request (intp22) input mode 1: txd1 output mode 1 pfc21 specifies operation mode of p21 pin in control mode. 0: external interrupt request (intp21) input mode 1: rxd1 input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 817 (3) selecting interrupt trigger mode the valid edges of the intp2n and nmi pins can be selected by program (n = 1 to 5). the level detection of the intp2n pin can also be selected. external interrupt rising edge specification register 2 (intr2) and external interrupt falling edge specification register 2 (intf2) are used to specify the valid edge and level detection. (a) external interrupt rising edge specification register 2 (intr2) and external interrupt falling edge specification register 2 (intf2) these registers are used to specify the trigger mode of an external interrupt request (intp2n) from an external pin and the non-maskable interrupt (nmi) (n = 1 to 5). the correspondence between each bit of this register and the external interrupt request and non-maskable interrupt controlled by that bit is as follows. ? nmif0 and nmir0 bits: nmi ? intf21 and intr21 bits: intp21 ? intf22 and intr22 bits: intp22 ? intf23 and intr23 bits: intp23 ? intf24 and intr24 bits: intp24 ? intf25 and intr25 bits: intp25 the rising edge, falling edge, or both the rising and falling edges can be specified as the valid edge of the intp2n pin and the rising or falling edge can be specified as the valid edge of the nmi pin, independently for each pin. both the registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode of the intp2n pin, set the pmc2 register (n = 1 to 5). if the pmc2 register is set after the intr2 and intf2 registers have been set, an illegal interrupt may occur when the pmc2 register is set.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 818 7 0 intr2 6 0 5 intr25 4 intr24 3 intr23 2 intr22 1 intr21 0 nmir0 address fffffc24h after reset 3fh 0 intf2 0 intf25 intf24 intf23 intf22 intf21 nmif0 fffffc04h 00h bit position bit name function specify trigger mode of intp2n pin. intf2n intr2n operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 5 to 1 intf2n, intr2n (n = 1 to 5) specify trigger mode of nmi pin. nmif0 nmir0 operation 0 0 falling edge 0 1 rising edge 1 0 setting prohibited 1 1 both rising and falling edges 0nmif0, nmir0 notes 1. the level of the intp2n pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the p2ifn bit (n = 1 to 5). consequently, even when the cpu acknowledges the interrupt and the p2ifn bit of the interrupt control register (p2icn) is automatically cleared to 0, the p2ifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intp2n pin of the external device inactive in the interrupt servicing routine, and forcibly clear the p2ifn bit to 0. 2. if a level-detected interrupt request (intp2n) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intp2n) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intp2n) is held pending (n = 1 to 5). to not acknowledge the interrupt request of intp2n, clear the p2ifn bit of the interrupt control register.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 819 14.3.3 port 5 port 5 is a 6-bit i/o port that can be set to the input or output mode in 1-bit units. 7 0 p5 6 0 5 p55 4 p54 3 p53 2 p52 1 p51 0 p50 address fffff40ah after reset undefined bit position bit name function 5 to 0 p5n (n = 5 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their function as port pins, the port 5 pins can also operate as the dma controller i/o, real-time pulse unit (rpu) i/o, and external interrupt request input in the control mode. (1) operation in control mode port alternate function remark block type p50 intp50/dmarq0 external interrupt request input/dma request input f-3 p51 intp51/dmaak0 external interrupt request input/ dma acknowledge signal output p52 intp52/tc0 external interrupt request input/dma end signal output g-2 p53 intpc00/tic0/ dmarq1 external interrupt request and timer c0 external capture trigger input/real-time pulse unit (rpu) input/ dma request input f-2 p54 intpc01/dmaak1 external interrupt request and timer c0 external capture trigger input/dma acknowledge signal output g-1 port 5 p55 toc0/tc1 real-time pulse unit (rpu) output/ dma end signal output j-1
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 820 (2) i/o mode/control mode setting the port 5 i/o mode setting is performed by the port 5 mode register (pm5), and the control mode setting is performed by the port 5 mode control register (pmc5) and port 5 function control register (pfc5). (a) port 5 mode register (pm5) this register can be read or written in 8-bit or 1-bit units. 7 1 pm5 6 1 5 pm55 4 pm54 3 pm53 2 pm52 1 pm51 0 pm50 address fffff42ah after reset ffh bit position bit name function 5 to 0 pm5n (n = 5 to 0) specifies input/output mode for p5n pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port 5 mode control register (pmc5) this register can be read or written in 8-bit or 1-bit units. 7 0 pmc5 6 0 5 pmc55 4 pmc54 3 pmc53 2 pmc52 1 pmc51 0 pmc50 address fffff44ah after reset 00h bit position bit name function 5 pmc55 specifies operation mode of p55 pin in combination with the pfc5 register. 0: i/o port mode 1: toc0 output mode/dma end signal (tc1) output mode 4 pmc54 specifies operation mode of p54 pin in combination with the pfc5 register. 0: i/o port mode 1: external interrupt request and timer c0 external capture trigger (intpc01) input mode/dma acknowledge signal (dmaak1) output mode 3pmc53 specifies operation mode of p53 pin in combination with the pfc5 register. 0: i/o port mode 1: external interrupt request and timer c0 external capture trigger (intpc00) input mode/tic0 input mode/dma request (dmarq1) input mode 2 pmc52 specifies operation mode of p52 pin in combination with the pfc5 register. 0: i/o port mode 1: external interrupt request (intp52) input mode/dma end signal (tc0) output mode 1pmc51 specifies operation mode of p51 pin in combination with the pfc5 register. 0: i/o port mode 1: external interrupt request (intp51) input mode/dma acknowledge signal (dmaak0) output mode 0 pmc50 specifies operation mode of p50 pin in combination with the pfc5 register. 0: i/o port mode 1: external interrupt request (intp50) input mode/dma request (dmarq0) input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 821 (c) port 5 function control register (pfc5) this register can be read or written in 8-bit or 1-bit units. caution when the port mode is specified by the port 5 mode control register (pmc5), the setting of this register becomes invalid. 7 0 pfc5 6 0 5 pfc55 4 pfc54 3 pfc53 2 pfc52 1 pfc51 0 pfc50 address fffff46ah after reset 00h bit position bit name function 5 pfc55 specifies operation mode of p55 pin in control mode. 0: toc0 output mode 1: dma end signal (tc1) output mode 4 pfc54 specifies operation mode of p54 pin in control mode. 0: external interrupt request and timer c0 external capture trigger (intpc01) input mode 1: dma acknowledge signal (dmaak1) output 3 pfc53 specifies operation mode of p53 pin in control mode. 0: external interrupt request and timer c0 external capture trigger (intpc01) input mode/tic0 input mode 1: dma request (dmarq1) input mode there is no register that selects an external interrupt request and timer c0 external capture trigger (intpc00) input mode or tic0 input mode. ? to use tic0 input mode: mask the external interrupt request and external capture trigger (intpc00) of timer c0, or use the ccc00 register as a compare register. ? to use external interrupt request and external capture trigger (intpc00) of timer c0: clear the etic0 bit of the tmcc01 register to 0. 2 pfc52 specifies operation mode of p52 pin. 0: external interrupt request (intp52) input mode 1: dma end signal (tc0) output mode 1 pfc51 specifies operation mode of p51 pin. 0: external interrupt request (intp51) input mode 1: dma acknowledge signal (dmaak0) output 0 pfc50 specifies operation mode of p50 pin in control mode. 0: external interrupt request (intp50) input mode 1: dma request (dmarq0) input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 822 (3) selecting interrupt trigger mode the valid edges of the intp5n pin can be selected by program (n = 0 to 2). the level detection of the intp5n pin can also be selected. external interrupt rising edge specification register 5 (intr5) and external interrupt falling edge specification register 5 (intf5) are used to specify the valid edge and level detection. (a) external interrupt rising edge specification register 5 (intr5) and external interrupt falling edge specification register 5 (intf5) these registers are used to specify the trigger mode of an external interrupt request (intp5n) from an external pin (n = 0 to 2). the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intf50 and intr50 bits: intp50 ? intf51 and intr51 bits: intp51 ? intf52 and intr52 bits: intp52 the rising edge, falling edge, or both the rising and falling edges can be specified as the valid edge of the intp5n pin, independently for each pin. both the registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode, set the pmc5 register. if the pmc5 register is set after the intr5 and intf5 registers have been set, an illegal interrupt may occur when the pmc5 register is set.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 823 7 0 intr5 6 0 5 0 4 0 3 0 2 intr52 1 intr51 0 intr50 address fffffc2ah after reset 07h 0 intf5 0000 intf52 intf51 intf50 fffffc0ah 00h bit position bit name function specify trigger mode of intp5n pin. intf5n intr5n operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 2 to 0 intf5n, intr5n (n = 0 to 2) notes 1. the level of the intp5n pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the p5ifn bit (n = 0 to 2). consequently, even when the cpu acknowledges the interrupt and the p5ifn bit of the interrupt control register (p5icn) is automatically cleared to 0, the p5ifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intp5n pin of the external device inactive in the interrupt servicing routine, and forcibly clear the p5ifn bit to 0. 2. if a level-detected interrupt request (intp5n) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intp5n) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intp5n) is held pending (n = 0 to 2). to not acknowledge the interrupt request of intp5n, clear the p5ifn bit of the interrupt control register.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 824 14.3.4 port 6 port 6 is a 3-bit i/o port that can be set to the input or output mode in 1-bit units. 7 p67 p6 6 p66 5 p65 4 0 3 0 2 0 1 0 0 0 address fffff40ch after reset undefined bit position bit name function 7 to 5 p6n (n = 7 to 5) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their function as port pins, the port 6 pins can also operate as the real-time pulse unit (rpu) i/o and external interrupt request input in the control mode. (1) operation in control mode port alternate function remark block type p65 intp65/intpc10/ tic1 external interrupt request and timer c1 external capture trigger input/real-time pulse unit (rpu) input p66 intp66/intpc11 external interrupt request and timer c1 external capture trigger input l-5 port 6 p67 intp67/toc1 external interrupt request input/ real-time pulse unit (pru) output l-3
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 825 (2) i/o mode/control mode setting the port 6 i/o mode setting is performed by the port 6 mode register (pm6), and the control mode setting is performed by the port 6 mode control register (pmc6) and port 6 function control register (pfc6). (a) port 6 mode register (pm6) this register can be read or written in 8-bit or 1-bit units. 7 pm67 pm6 6 pm66 5 pm65 4 1 3 1 2 1 1 1 0 1 address fffff42ch after reset ffh bit position bit name function 7 to 5 pm6n (n = 7 to 5) specifies input/output mode for p6n pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port 6 mode control register (pmc6) this register can be read or written in 8-bit or 1-bit units. 7 pmc67 pmc6 6 pmc66 5 pmc65 4 0 3 0 2 0 1 0 0 0 address fffff44ch after reset 00h bit position bit name function 7 pmc67 specifies operation mode of p67 pin. 0: i/o port mode 1: external interrupt request (intp67) input mode/toc1 output mode 6 pmc66 specifies operation mode of p66 pin. 0: i/o port mode 1: external interrupt request (intp66) input mode/external interrupt request and timer c1 external capture trigger (intpc11) input mode 5pmc65 specifies operation mode of p65 pin. 0: i/o port mode 1: external interrupt request (intp65) input mode/external interrupt request and timer c1 external capture trigger (intpc10) input mode/tic1 input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 826 (c) port 6 function control register (pfc6) this register can be read or written in 8-bit or 1-bit units. caution when the port mode is specified by the port 6 mode control register (pmc6), the setting of this register becomes invalid. 7 pfc67 pfc6 6 pfc66 5 pfc65 4 0 3 0 2 0 1 0 0 0 address fffff46ch after reset 00h bit position bit name function 7 pfc67 specifies operation mode of p67 pin in control mode. 0: external interrupt request (intp67) input mode 1: toc1 output mode 6 pfc66 specifies operation mode of p66 pin in control mode. 0: external interrupt request (intp66) input mode 1: external interrupt request and timer c1 external capture trigger (intpc11) input mode 5 pfc65 specifies operation mode of p65 pin in control mode. 0: external interrupt request (intp65) input mode 1: external interrupt request and timer c1 external capture trigger (intpc10) input mode/tic1 input mode there is no register that selects an external interrupt request and timer c1 external capture trigger (intpc10) input mode or tic1 input mode. ? to use tic1 input mode: mask the external interrupt request and external capture trigger (intpc10) of timer c1, or use the ccc10 register as a compare register. ? to use external interrupt request and external capture trigger (intpc10) of timer c1: clear the etic1 bit of the tmcc11 register to 0.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 827 (3) selecting interrupt trigger mode the valid edges of the intp6n pin can be selected by program (n = 5 to 7). the level detection of the intp6n pin can also be selected. external interrupt rising edge specification register 6 (intr6) and external interrupt falling edge specification register 6 (intf6) are used to specify the valid edge and level detection. (a) external interrupt rising edge specification register 6 (intr6) and external interrupt falling edge specification register 6 (intf6) these registers are used to specify the trigger mode of an external interrupt request (intp6n) from an external pin (n = 5 to 7). the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intf65 and intr65 bits: intp65 ? intf66 and intr66 bits: intp66 ? intf67 and intr67 bits: intp67 the rising edge, falling edge, or both the rising and falling edges can be specified as the valid edge of the intp6n pin, independently for each pin. both the registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode, set the pmc6 register. if the pmc6 register is set after the intr6 and intf6 registers have been set, an illegal interrupt may occur when the pmc6 register is set.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 828 7 intr67 intr6 6 intr66 5 intr65 4 0 3 0 2 0 1 0 0 0 address fffffc2ch after reset e0h intf67 intf6 intf66 intf65 00000 fffffc0ch 00h bit position bit name function specify trigger mode of intp6n pin. intf6n intr6n operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 7 to 5 intf6n, intr6n (n = 7 to 5) notes 1. the level of the intp6n pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the p6ifn bit (n = 5 to 7). consequently, even when the cpu acknowledges the interrupt and the p6ifn bit of the interrupt control register (p6icn) is automatically cleared to 0, the p6ifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intp6n pin of the external device inactive in the interrupt servicing routine, and forcibly clear the p6ifn bit to 0. 2. if a level-detected interrupt request (intp6n) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intp6n) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intp6n) is held pending (n = 5 to 7). to not acknowledge the interrupt request of intp6n, clear the p6ifn bit of the interrupt control register.
chapter 14 port functions preliminary user?s manual u16031ej2v1ud 829 14.3.5 port 7 port 7 is a 6-bit i/o port that can be set to the input or output mode in 1-bit units. 7 p77 p7 6 p76 5 p75 4 p74 3 p73 2 p72 1 0 0 0 address fffff40eh after reset undefined bit position bit name function 7 to 2 p7n (n = 7 to 2) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their function as port pins, the port 7 pins can also operate as the dma controller i/o, real-time pulse unit (rpu) i/o, and external interrupt request input in the control mode. (1) operation in control mode port alternate function remark block type p72 intpc20/tic2/ dmarq2 external interrupt request and timer c2 external capture trigger input/real-rime pulse unit (rpu) input/ dma request input l-4 p73 intpc21/dmaak2 external interrupt request and timer c2 external capture trigger input/dma acknowledge signal output l-2 p74 toc2/tc2 real-time pulse unit (rpu) output/ dma end signal output l-1 p75 intpc30/tic3/ dmarq3 external interrupt request and timer c3 external capture trigger input/real-time pulse unit (rpu) input/ dma request input l-4 p76 intpc31/dmaak3 external interrupt request and timer c3 external capture trigger input/dma acknowledge signal output l-2 port 7 p77 toc3/tc3 real-time pulse unit (rpu) output/ dma end signal output l-1
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 830 (2) i/o mode/control mode setting the port 7 i/o mode setting is performed by the port 7 mode register (pm7), and the control mode setting is performed by the port 7 mode control register (pmc7) and port 7 function control register (pfc7). (a) port 7 mode register (pm7) this register can be read or written in 8-bit or 1-bit units. 7 pm77 pm7 6 pm76 5 pm75 4 pm74 3 pm73 2 pm72 1 1 0 1 address fffff42eh after reset ffh bit position bit name function 7 to 2 pm7n (n = 7 to 2) specifies input/output mode for p7n pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port 7 mode control register (pmc7) this register can be read or written in 8-bit or 1-bit units. 7 pmc77 pmc7 6 pmc76 5 pmc75 4 pmc74 3 pmc73 2 pmc72 1 0 0 0 address fffff44eh after reset 00h bit position bit name function 7 pmc77 specifies operation mode of p77 pin in combination with the pfc7 register. 0: i/o port mode 1: toc3 output mode/dma end signal (tc3) output mode 6 pmc76 specifies operation mode of p76 pin in combination with the pfc7 register. 0: i/o port mode 1: external interrupt request and time c3 external capture trigger (intpc31) input mode/dma acknowledge signal (dmaak3) output mode 5pmc75 specifies operation mode of p75 pin in combination with the pfc7 register. 0: i/o port mode 1: external interrupt request and timer c3 external capture trigger (intpc30) input mode/tic3 input mode/dma request (dmarq3) input mode 4 pmc74 specifies operation mode of p74 pin in combination with the pfc7 register. 0: i/o port mode 1: toc2 output mode/dma end signal (tc2) output mode 3pmc73 specifies operation mode of p73 pin in combination with the pfc7 register. 0: i/o port mode 1: external interrupt request and time c2 external capture trigger (intpc21) input mode/dma acknowledge signal (dmaak2) output mode 2 pmc72 specifies operation mode of p72 pin in combination with the pfc7 register. 0: i/o port mode 1: external interrupt request and timer c2 external capture trigger (intpc20) input mode/tic2 input mode/dma request (dmarq2) input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 831 (c) port 7 function control register (pfc7) this register can be read or written in 8-bit or 1-bit units. caution when the port mode is specified by the port 7 mode control register (pmc7), the setting of this register becomes invalid. 7 pfc77 pfc7 6 pfc76 5 pfc75 4 pfc74 3 pfc73 2 pfc72 1 0 0 0 address fffff46eh after reset 00h bit position bit name function 7 pfc77 specifies operation mode of p77 pin in control mode. 0: toc3 output mode 1: dma end signal (tc3) output mode 6 pfc76 specifies operation mode of p76 pin in control mode. 0: external interrupt request and timer c3 external capture trigger (intpc31) input mode 1: dma acknowledge signal (dmaak3) output 5 pfc75 specifies operation mode of p75 pin in control mode. 0: external interrupt request and timer c3 external capture trigger (intpc30) input mode/tic3 input mode 1: dma request (dmarq3) input mode there is no register that selects an external interrupt request and timer c3 external capture trigger (intpc30) input mode or tic3 input mode. ? to use tic3 input mode: mask the external interrupt request and external capture trigger (intpc30) of timer c3, or use the ccc30 register as a compare register. ? to use external interrupt request and external capture trigger (intpc30) of timer c3: clear the etic3 bit of the tmcc31 register to 0. 4 pfc74 specifies operation mode of p74 pin. 0: toc2 output mode 1: dma end signal (tc2) output mode 3 pfc73 specifies operation mode of p73 pin. 0: external interrupt request and timer c2 external capture trigger (intpc21) input mode 1: dma acknowledge signal (dmaak2) output 2 pfc72 specifies operation mode of p72 pin in control mode. 0: external interrupt request and timer c2 external capture trigger (intpc20) input mode/tic2 input mode 1: dma request (dmarq2) input mode there is no register that selects an external interrupt request and timer c2 external capture trigger (intpc20) input mode or tic2 input mode. ? to use tic2 input mode: mask the external interrupt request and external capture trigger (intpc20) of timer c2, or use the ccc20 register as a compare register. ? to use external interrupt request and external capture trigger (intpc20) of timer c2: clear the etic2 bit of the tmcc21 register to 0.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 832 14.3.6 port al port al (pal) is a 16-bit i/o port that can be set to the input or output mode in 1-bit units. when the higher 8 bits of port al are used as port alh (palh) and the lower 8 bits as port all (pall), port al becomes two 8-bit ports that can be set in the input or output mode in 1-bit units. 15 0 7 0 pal 14 0 6 0 13 0 5 0 12 0 4 0 11 0 3 0 10 0 2 0 9 0 1 pal1 8 0 0 pal0 address fffff001h address fffff000h after reset undefined bit position bit name function 1, 0 paln (n = 1, 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their functions as port pins, in the control mode, the port al pins operate as an address bus for when the memory is externally expanded and external interrupt request input. (1) operation in control mode port alternate function remark block type port al pal0, pal1 intpl0/a0, intpl1/a1 address bus when memory expanded/ external interrupt request input g-3
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 833 (2) i/o mode/control mode setting the port al i/o mode setting is performed by the port al mode register (pmal), and control mode setting is performed by port al mode control register l (pmcall) and the port al function control register (pfcal). (a) port al mode register (pmal) the port al mode register (pmal) can be read or written in 16-bit units. when using the higher 8 bits of pmal as port al mode register h (pmalh) and the lower 8 bits as port al mode register l (pmall), the pmalh register is read-only in 8-bit or 1-bit units, and the pmall register can be read or written in 8-bit or 1-bit units. 15 1 7 1 pmal 14 1 6 1 13 1 5 1 12 1 4 1 11 1 3 1 10 1 2 1 9 1 1 pmal1 8 1 0 pmal0 address fffff021h address fffff020h after reset ffffh bit position bit name function 1, 0 pmaln (n = 1, 0) specifies input/output mode for paln pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port al mode control register (pmcal) the port al mode control register (pmcal) can be read or written in 16-bit units. when using the higher 8 bits of pmcal as port al mode control register h (pmcalh) and the lower 8 bits as port al mode control register l (pmcall), the pmcalh register is read-only in 8-bit or 1-bit units, and the pmcall register can be read or written in 8-bit or 1-bit units. 15 0 7 0 pmcal 14 0 6 0 13 0 5 0 12 0 4 0 11 0 3 0 10 0 2 0 9 0 1 pmcal1 8 0 0 pmcal0 address fffff041h address fffff040h after reset 0002h bit position bit name function 1 pmcal1 specifies operation mode of pal1 pin. 0: i/o port mode 1: intpl1 input mode/a1 output mode 0 pmcal0 specifies operation mode of pal0 pin. 0: i/o port mode 1: intpl0 input mode/a0 output mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 834 (c) port al function control register l (pfcall) this register can be read or written in 8-bit or 1-bit units. caution when the port mode is specified by the port al mode control register (pmcal), the setting of this register becomes invalid. 7 0 pfcall 6 0 5 0 4 0 3 0 2 0 1 pfcal1 0 pfcal0 address fffff058h after reset 03h bit position bit name function 1 pfcal1 specifies operation mode of pal1 pin in control mode. 0: external interrupt request (intpl1) input mode 1: a1 output mode 0 pfcal0 specifies operation mode of pal0 pin in control mode. 0: external interrupt request (intpl0) input mode 1: a0 output mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 835 (3) selecting interrupt trigger mode the valid edges of the intpln pin can be selected by program (n = 0, 1). the level detection of the intpln pin can also be selected. external interrupt rising edge specification register al (intral) and external interrupt falling edge specification register al (intfal) are used to specify the valid edge and level detection. (a) external interrupt rising edge specification register al (intral) and external interrupt falling edge specification register al (intfal) these registers are used to specify the trigger mode of an external interrupt request (intpln) from an external pin (n = 0, 1). the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intfal0 and intral0 bits: intpal0 ? intfal1 and intral1 bits: intpal1 the rising edge, falling edge, or both the rising and falling edges can be specified as the valid edge of the intpln pin, independently for each pin. both the registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode, set the pmcal register. if the pmcal register is set after the intral and intfal registers have been set, an illegal interrupt may occur when the pmcal register is set.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 836 7 0 intral 6 0 5 0 4 0 3 0 2 0 1 intral1 0 intral0 address fffffc30h after reset 03h 0 intfal 00000 intfal1 intfal0 fffffc10h 00h bit position bit name function specify trigger mode of intpln pin. intfaln intraln operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 1, 0 intfaln, intraln (n = 0, 1) notes 1. the level of the intpln pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the plifn bit (n = 0, 1). consequently, even when the cpu acknowledges the interrupt and the plifn bit of the interrupt control register (plicn) is automatically cleared to 0, the plifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intpln pin of the external device inactive in the interrupt servicing routine, and forcibly clear the plifn bit to 0. 2. if a level-detected interrupt request (intpln) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intpln) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intpln) is held pending (n = 0, 1). to not acknowledge the interrupt request of intpln, clear the plifn bit of the interrupt control register.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 837 14.3.7 port ah port ah (pah) is a 10-bit i/o port that can be set in the input or output mode in 1-bit units. when the higher 8 bits of port ah are used as port ahh (pahh) and the lower 8 bits as port ahl (pahl), port ah becomes two 8-bit ports that can be set in the input or output mode in 1-bit units. 15 0 7 pah7 pah 14 0 6 pah6 13 0 5 pah5 12 0 4 pah4 11 0 3 pah3 10 0 2 pah2 9 pah9 1 pah1 8 pah8 0 pah0 address fffff003h address fffff002h after reset undefined bit position bit name function 9 to 0 pahn (n = 9 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their functions as port pins, in the control mode, the port ah pins operate as an address bus for when the memory is externally expanded. (1) operation in control mode port alternate function remark block type port ah pal9 to pal0 a25 to a16 address bus when memory expanded d-2
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 838 (2) i/o mode/control mode setting the port ah i/o mode setting is performed by the port ah mode register (pmah), and the control mode setting is performed by the port ah mode control register (pmcah). (a) port ah mode register (pmah) the port ah mode register (pmah) can be read or written in 16-bit units. if the higher 8 bits of pmah are used as port ah mode register h (pmahh), and the lower 8 bits as port ah mode register l (pmahl), these two 8-bit port mode registers can be read or written in 8-bit or 1-bit units. 15 1 7 pmah7 pmah 14 1 6 pmah6 13 1 5 pmah5 12 1 4 pmah4 11 1 3 pmah3 10 1 2 pmah2 9 pmah9 1 pmah1 8 pmah8 0 pmah0 address fffff023h address fffff022h after reset ffffh bit position bit name function 9 to 0 pmahn (n = 9 to 0) specifies input/output mode for pahn pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port ah mode control register (pmcah) the port ah mode control register (pmcah) can be read or written in 16-bit units. if the higher 8 bits of pmcah are used as port ah mode control register h (pmcahh), and the lower 8 bits as port ah mode control register l (pmcahl), these two 8-bit port mode registers can be read or written in 8-bit or 1-bit units. 15 0 7 pmcah7 pmcah 14 0 6 pmcah6 13 0 5 pmcah5 12 0 4 pmcah4 11 0 3 pmcah3 10 0 2 pmcah2 9 pmcah9 1 pmcah1 8 pmcah8 0 pmcah0 address fffff043h address fffff042h after reset 03ffh bit position bit name function 9 to 0 pmcahn (n = 9 to 0) specifies operation mode of pahn pin. 0: i/o port mode 1: a25 to a16 output mode
chapter 14 port functions preliminary user?s manual u16031ej2v1ud 839 14.3.8 port dh port dh (pdh) is a 16-bit i/o port that can be set in the input or output mode in 1-bit units. when the higher 8 bits of port dh are used as port dhh (pdhh), and the lower 8 bits as port dhl (pdhl), port dh becomes two 8-bit ports that can be set in the input or output mode in 1-bit units. caution in the 32-bit mode (mode1 and mode0 pins = 00) and when the bmodcn bit of the pfcdh register is set, all the register functions of port dh (see 14.3.8) become invalid. 15 pdh15 7 pdh7 pdh 14 pdh14 6 pdh6 13 pdh13 5 pdh5 12 pdh12 4 pdh4 11 pdh11 3 pdh3 10 pdh10 2 pdh2 9 pdh9 1 pdh1 8 pdh8 0 pdh0 address fffff007h address fffff006h after reset undefined bit position bit name function 15 to 0 pdhn (n = 15 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their functions as port pins, in the control mode, the port dh pins operate as a data bus for when the memory is externally expanded, real-time pulse unit (rpu) i/o, pwm output, and external interrupt request input. (1) operation in control mode (1/2) port alternate function remark block type pdh0 d16/intpd0 data bus when memory expanded/ external interrupt request input pdh1 d17/intpd1 data bus when memory expanded/ external interrupt request input m-1 pdh2 d18/intpd2/toc4 data bus when memory expanded/ external interrupt request input/ real-time pulse unit (rpu) output m-2 pdh3 d19/intpd3 data bus when memory expanded/ external interrupt request input pdh4 d20/intpd4 data bus when memory expanded/ external interrupt request input m-1 pdh5 d21/intpd5/toc5 data bus when memory expanded/ external interrupt request input/ real-time pulse unit (rpu) output m-2 port dh pdh6 d22/intpd6/ intp100/tcud10 data bus when memory expanded/ external interrupt request input/ timer enc10 external capture trigger input/ real-time pulse unit (rpu) input m-3
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 840 (2/2) port alternate function remark block type pdh7 d23/intpd7/ intp101/tclr10 data bus when memory expanded/ external interrupt request input/ timer enc10 external capture trigger input/ real-time pulse unit (rpu) input m-3 pdh8 d24/intpd8/to10 data bus when memory expanded/ external interrupt request input/ real-time pulse unit (rpu) output m-2 pdh9 d25/intpd9/ tiud10 data bus when memory expanded/ external interrupt request input/ real-time pulse unit (rpu) input pdh10 d26/intpd10/ intp110/tcud11 data bus when memory expanded/ external interrupt request input/ timer enc11 external capture trigger input/ real-time pulse unit (rpu) input pdh11 d27/intpd11/ intp111/tclr11 data bus when memory expanded/ external interrupt request input/ timer enc11 external capture trigger input/ real-time pulse unit (rpu) input m-3 pdh12 d28/intpd12/to11 data bus when memory expanded/ external interrupt request input/ real-time pulse unit (rpu) output m-2 pdh13 d29/intpd13/ tiud11 data bus when memory expanded/ external interrupt request input/ real-time pulse unit (rpu) input m-3 pdh14 d30/intpd14/ pwm0 data bus when memory expanded/ external interrupt request input/pwm output port dh pdh15 d31/intpd15/ pwm1 data bus when memory expanded/ external interrupt request input/pwm output m-2
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 841 (2) i/o mode/control mode setting the port dh i/o mode setting is performed by the port dh mode register (pmdh), and the control mode setting is performed by the port dh mode control register (pmcdh) an port dh function control register (pfcdh). (a) port dh mode register (pmdh) the port dh mode register (pmdh) can be read or written in 16-bit units. if the higher 8 bits of pmdh are used as port dh mode register h (pmdhh), and the lower 8 bits as port dh mode register l (pmdhl), these two 8-bit port mode registers can be read or written in 8-bit or 1-bit units. 15 pmdh15 7 pmdh7 pmdh 14 pmdh14 6 pmdh6 13 pmdh13 5 pmdh5 12 pmdh12 4 pmdh4 11 pmdh11 3 pmdh3 10 pmdh10 2 pmdh2 9 pmdh9 1 pmdh1 8 pmdh8 0 pmdh0 address fffff027h address fffff026h after reset ffffh bit position bit name function 15 to 0 pmdhn (n = 15 to 0) specifies input/output mode for pdhn pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port dh mode control register (pmcdh) the port dh mode control register (pmcdh) can be read or written in 16-bit units. if the higher 8 bits of pmcdh are used as port dh mode control register h (pmcdhh), and the lower 8 bits as port dh mode control register l (pmcdhl), these two 8-bit port mode registers can be read or written in 8-bit or 1-bit units. (1/2) 15 pmcdh15 7 pmcdh7 pmcdh 14 pmcdh14 6 pmcdh6 13 pmcdh13 5 pmcdh5 12 pmcdh12 4 pmcdh4 11 pmcdh11 3 pmcdh3 10 pmcdh10 2 pmcdh2 9 pmcdh9 1 pmcdh1 8 pmcdh8 0 pmcdh0 address fffff047h address fffff046h after reset 0000h bit position bit name function 15 pmcdh15 specifies operation mode of pdh15 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd15) input mode/pwm1 output mode 14 pmcdh14 specifies operation mode of pdh14 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd14) input mode/pwm0 output mode 13 pmcdh13 specifies operation mode of pdh13 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd13) input mode/tiud11 input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 842 (2/2) bit position bit name function 12 pmcdh12 specifies operation mode of pdh12 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd12) input mode/to11 output mode 11 pmcdh11 specifies operation mode of pdh11 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd11) input mode/timer enc11 external capture trigger (intp111) input mode/tclr11 input mode 10 pmcdh10 specifies operation mode of pdh10 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd10) input mode/timer enc11 external capture trigger (intp110) input mode/tcud11 input mode 9 pmcdh9 specifies operation mode of pdh9 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd9) input mode/tiud10 input mode 8 pmcdh8 specifies operation mode of pdh8 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd8) input mode/to10 output mode 7 pmcdh7 specifies operation mode of pdh7 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd7) input mode/timer enc10 external capture trigger (intp101) input mode/tclr10 input mode 6 pmcdh6 specifies operation mode of pdh6 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd6) input mode/timer enc10 external capture trigger (intp100) input mode/tcud10 input mode 5 pmcdh5 specifies operation mode of pdh5 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd5) input mode/toc5 output mode 4 pmcdh4 specifies operation mode of pdh4 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd4) input mode 3 pmcdh3 specifies operation mode of pdh3 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd3) input mode 2 pmcdh2 specifies operation mode of pdh2 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd2) input mode/toc4 output mode 1 pmcdh1 specifies operation mode of pdh1 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd1) input mode 0 pmcdh0 specifies operation mode of pdh0 pin in combination with the pfcdh register. 0: i/o port mode 1: external interrupt request (intpd0) input mode
chapter 14 port functions preliminary user?s manual u16031ej2v1ud 843 (c) port dh function control register (pfcdh) this register can be read or written in 8-bit or 1-bit units. if the higher 8 bits of the pfcdh are used as port dh function control register h (pfcdhh), and the lower 8 bits as port dh function control register l (pfcdhl), these registers can be read or written in 8- bit or 1-bit units. caution when the port mode is specified by the port dh mode control register (pmcdh), the setting of this register becomes invalid. however, bit 0 is independent of the setting of the pmcdh0 bit of the pmcdh register. (1/3) 15 pfcdh15 7 pfcdh7 pfcdh 14 pfcdh14 6 pfcdh6 13 pfcdh13 5 pfcdh5 12 pfcdh12 4 0 11 pfcdh11 3 0 10 pfcdh10 2 pfcdh2 9 pfcdh9 1 0 8 pfcdh8 0 bmodcn address fffff057h address fffff056h after reset 0000h bit position bit name function 15 pfcdh15 specifies operation mode of pdh15 pin in control mode. 0: external interrupt request (intpd15) input mode 1: pwm1 output mode 14 pfcdh14 specifies operation mode of pdh14 pin in control mode. 0: external interrupt request (intpd14) input mode 1: pwm0 output mode 13 pfcdh13 specifies operation mode of pdh13 pin in control mode. 0: external interrupt request (intpd13) input mode 1: tiud11 input mode 12 pfcdh12 specifies operation mode of pdh12 pin in control mode. 0: external interrupt request (intpd12) input mode 1: to11 output mode 11 pfcdh11 specifies operation mode of pdh11 pin in control mode. 0: external interrupt request (intpd11) input mode 1: timer enc11 external capture trigger (intp111) input mode/tclr11 input mode there is no register that selects a timer enc11 external capture trigger (intp111) input mode or tclr11 input mode. ? to use tclr11 input mode: mask the external capture trigger (intp111) of timer enc11, or use the cc111 register as a compare register. ? to use external capture trigger (intp111) of timer enc11: set the clr111 and clr110 bits of the tmc11 register to other than 00.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 844 (2/3) bit position bit name function 10 pfcdh10 specifies operation mode of pdh10 pin in control mode. 0: external interrupt request (intpd10) input mode 1: timer enc11 external capture trigger (intp110) input mode/tcud10 input mode there is no register that selects a timer enc11 external capture trigger (intp110) input mode or tcud10 input mode. ? to use tucd10 input mode: mask the external capture trigger (intp110) of timer enc11, or use the cc110 register as a compare register. ? to use external capture trigger (intp110) of timer enc11: set the t1cmd1 bit of the tum11 register to 0. 9 pfcdh9 specifies operation mode of pdh9 pin in control mode. 0: external interrupt request (intpd9) input mode 1: tiud10 input mode 8 pfcdh8 specifies operation mode of pdh8 pin in control mode. 0: external interrupt request (intpd8) input mode 1: to10 output mode 7 pfcdh7 specifies operation mode of pdh7 pin in control mode. 0: external interrupt request (intpd7) input mode 1: timer enc10 external capture trigger (intp101) input mode/tclr10 input mode there is no register that selects a timer enc10 external capture trigger (intp101) input mode or tclr10 input mode. ? to use tclr10 input mode: mask the external capture trigger (intp101) of timer enc10, or use the cc101 register as a compare register. ? to use external capture trigger (intp101) of timer enc10: set the clr101 and clr100 bits of the tmc10 register to other than 00. 6 pfcdh6 specifies operation mode of pdh6 pin in control mode. 0: external interrupt request (intpd6) input mode 1: timer enc10 external capture trigger (intp100) input mode/tcud10 input mode there is no register that selects a timer enc10 external capture trigger (intp100) input mode or tcud10 input mode. ? to use tucd10 input mode: mask the external capture trigger (intp100) of timer enc10, or use the cc100 register as a compare register. ? to use external capture trigger (intp100) of timer enc10: set the t1cmd0 bit of the tum10 register to 0. 5 pfcdh5 specifies operation mode of pdh5 pin in control mode. 0: external interrupt request (intpd5) input mode 1: toc5 output mode 2 pfcdh2 specifies operation mode of pdh2 pin in control mode. 0: external interrupt request (intpd2) input mode 1: toc4 output mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 845 (3/3) bit position bit name function 0 bmodcn specifies the operation mode of the d16 to d31 pins in the 16-bit mode (16-bit data bus). however, changing the value of the bmodcn bit from 0 to 1 is not reflected in the lbs register. 0: the d16 to d31 pins are not used for starting in the 16-bit mode (data bus width: 16/8 bits). 1: the d16 to d31 pins are not used for starting in the 16-bit mode (data bus width: 32/16/8 bits). caution the bmodcn bit is valid only when the 16-bit mode is specified in accordance with the status of the mode0 and mode1 pins. this bit is invalid if the 32-bit mode is specified. the bmodcn bit can be rewritten only once. if it is rewritten twice or more, the operation is not guaranteed. when the bmodcn bit = 1, the operation is the same as when the 32-bit mode is specified in accordance with the status of the mode0 and mode1 pins.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 846 (3) selecting interrupt trigger mode the valid edges of the intpdn pin can be selected by program (n = 0 to 15). the level detection of the intpdn pin can also be selected. external interrupt rising edge specification register dh (intrdh) and external interrupt falling edge specification register dh (intfdh) are used to specify the valid edge and level detection. (a) external interrupt rising edge specification register dh (intrdh) and external interrupt falling edge specification register dh (intfdh) these registers are used to specify the trigger mode of an external interrupt request (intpdn) from an external pin (n = 0 to 15). the correspondence between each bit of this register and the external interrupt request controlled by that bit is as follows. ? intfdh0 and intrdh0 bits: intpd0 ? intfdh1 and intrdh1 bits: intpd1 ? intfdh2 and intrdh2 bits: intpd2 ? intfdh3 and intrdh3 bits: intpd3 ? intfdh4 and intrdh4 bits: intpd4 ? intfdh5 and intrdh5 bits: intpd5 ? intfdh6 and intrdh6 bits: intpd6 ? intfdh7 and intrdh7 bits: intpd7 ? intfdh8 and intrdh8 bits: intpd8 ? intfdh9 and intrdh9 bits: intpd9 ? intfdh10 and intrdh10 bits: intpd10 ? intfdh11 and intrdh11 bits: intpd11 ? intfdh12 and intrdh12 bits: intpd12 ? intfdh13 and intrdh13 bits: intpd13 ? intfdh14 and intrdh14 bits: intpd14 ? intfdh15 and intrdh15 bits: intpd15 the rising edge, falling edge, or both the rising and falling edges can be specified as the valid edge of the intpdn pin, independently for each pin. intrdh and intfdh registers can be read or written in 16-bit units. when the higher 8 bits of the intrdh and intfdh registers are used as intrdhh and intfdhh registers, and the lower 8 bits as intrdhl and intfdhl registers, these registers can be read or written in 8-bit or 1-bit units. caution before setting the trigger mode, set the pmcdh register. if the pmcdh register is set after the intrdh and intfdh registers have been set, an illegal interrupt may occur when the pmcdh register is set.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 847 14 intr dh14 13 intr dh13 12 intr dh12 2 intr dh2 3 intr dh3 4 intr dh4 5 intr dh5 6 intr dh6 7 intr dh7 8 intr dh8 9 intr dh9 10 intr dh10 11 intr dh11 15 intr dh15 1 intr dh1 0 intr dh0 intrdh address fffffc36h after reset ffffh intf dh14 intf dh13 intf dh12 intf dh2 intf dh3 intf dh4 intf dh5 intf dh6 intf dh7 intf dh8 intf dh9 intf dh10 intf dh11 intf dh15 intf dh1 intf dh0 intfdh fffffc16h 0000h bit position bit name function specify trigger mode of intpdn pin. intfdhn intrdhn operation 0 0 falling edge 0 1 rising edge 1 0 level detection (low-level detection) notes 1, 2 1 1 both rising and falling edges 15 to 0 intfdhn, intrdhn (n = 0 to 15) notes 1. the level of the intpdn pin is sampled each time the main clock (f x ) is divided by four. when the low level of this pin is detected, an interrupt request is latched as the pdifn bit (n = 0 to 15). consequently, even when the cpu acknowledges the interrupt and the pdifn bit of the interrupt control register (pdicn) is automatically cleared to 0, the pdifn bit is immediately set to 1 and interrupts occur consecutively. to avoid this status, make the intpdn pin of the external device inactive in the interrupt servicing routine, and forcibly clear the pdifn bit to 0. 2. if a level-detected interrupt request (intpdn) with a lower priority occurs while an interrupt is being serviced and if this level-detected interrupt request (intpdn) that has newly occurred becomes inactive before the current interrupt has been serviced, the interrupt request of the new interrupt (intpdn) is held pending (n = 0 to 15). to not acknowledge the interrupt request of intpdn, clear the pdifn bit of the interrupt control register.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 848 14.3.9 port cs port cs (pcs) is an 8-bit i/o port that can be set to the input or output mode in 1-bit units. 7 pcs7 pcs 6 pcs6 5 pcs5 4 pcs4 3 pcs3 2 pcs2 1 pcs1 0 pcs0 address fffff008h after reset undefined bit position bit name function 7 to 0 pcsn (n = 7 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their function as port pins, in the control mode, the port pins can also operate as the chip select signal outputs when memory is externally expanded and the read/write strobe signal output to an external i/o. (1) operation in control mode port alternate function remark block type pcs0 cs0 chip select signal output pcs1 cs1 chip select signal output d-2 pcs2 cs2/iowr chip select signal output/write strobe signal output j-2 pcs3 cs3 chip select signal output pcs4 cs4 chip select signal output d-2 pcs5 cs5/iord chip select signal output/read strobe signal output j-2 pcs6 cs6 chip select signal output port cs pcs7 cs7 chip select signal output d-2
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 849 (2) i/o mode/control mode setting the port cs i/o mode setting is performed by the port cs mode register (pmcs), and the control mode setting is performed by the port cs mode control register (pmccs) and the port cs function control register (pfccs). (a) port cs mode register (pmcs) this register can be read or written in 8-bit or 1-bit units. 7 pmcs7 pmcs 6 pmcs6 5 pmcs5 4 pmcs4 3 pmcs3 2 pmcs2 1 pmcs1 0 pmcs0 address fffff028h after reset ffh bit position bit name function 7 to 0 pmcsn (n = 7 to 0) specifies input/output mode for pcsn pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port cs mode control register (pmccs) this register can be read or written in 8-bit or 1-bit units. 7 pmccs7 pmccs 6 pmccs6 5 pmccs5 4 pmccs4 3 pmccs3 2 pmccs2 1 pmccs1 0 pmccs0 address fffff048h after reset ffh bit position bit name function 7 pmccs7 specifies operation mode of pcs7 pin. 0: i/o port mode 1: cs7 output mode 6 pmccs6 specifies operation mode of pcs6 pin. 0: i/o port mode 1: cs6 output mode 5 pmccs5 specifies operation mode of pcs5 pin. 0: i/o port mode 1: cs5 output mode/iord output mode 4 pmccs4 specifies operation mode of pcs4 pin. 0: i/o port mode 1: cs4 output mode 3 pmccs3 specifies operation mode of pcs3 pin. 0: i/o port mode 1: cs3 output mode 2 pmccs2 specifies operation mode of pcs2 pin. 0: i/o port mode 1: cs2 output mode/iowr output mode 1 pmccs1 specifies operation mode of pcs1 pin. 0: i/o port mode 1: cs1 output mode 0 pmccs0 specifies operation mode of pcs0 pin. 0: i/o port mode 1: cs0 output mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 850 (c) port cs function control register (pfccs) this register can be read or written in 8-bit or 1-bit units. caution when the port mode is specified by the port cs mode control register (pmccs), the pfccs setting becomes invalid. 7 0 pfccs 6 0 5 pfccs5 4 0 3 0 2 pfccs2 1 0 0 0 address fffff049h after reset 00h bit position bit name function 5 pfccs5 specifies operation mode of pcs5 pin in control mode. 0: cs5 output mode 1: iord output mode note 2 pfccs2 specifies operation mode of pcs2 pin in control mode. 0: cs2 output mode 1: iowr output mode note note to output the iord and iowr signals during access to the external i/o other than by a dma flyby transfer, the ioen bit of the bcp register must be set.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 851 14.3.10 port ct port ct (pct) is a 6-bit i/o port that can be set to input or output mode in 1-bit units. 7 pct7 pct 6 0 5 pct5 4 pct4 3 pct3 2 pct2 1 pct1 0 pct0 address fffff00ah after reset undefined bit position bit name function 7, 5 to 0 pctn (n = 7, 5 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to the port function, this port outputs, in the control mode, control signals to externally expand the memory and byte enable signals when sdram is accessed in byte units. (1) operation in control mode port alternate function remark block type pct0 llwr/llbe/lldqm write strobe signal output/ byte enable signal output/ output disable/write mask signal pct1 luwr/lube/ludqm write strobe signal output/ byte enable signal output/ output disable/write mask signal pct2 ulwr/ulbe/uldqm write strobe signal output/ byte enable signal output/ output disable/write mask signal pct3 uuwr/uube/uudqm write strobe signal output/ byte enable signal output/ output disable/write mask signal j-3 pct4 rd read strobe signal output pct5 we/wr write enable signal output/ write strobe signal output port ct pct7 bcyst bus cycle status signal output d-2
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 852 (2) i/o mode/control mode setting the port ct i/o mode setting is performed by the port ct mode register (pmct), and the control mode setting is performed by the port ct mode control register (pmcct) and port ct function control register (pfcct). (a) port ct mode register (pmct) this register can be read or written in 8-bit or 1-bit units. 7 pmct7 pmct 6 1 5 pmct5 4 pmct4 3 pmct3 2 pmct2 1 pmct1 0 pmct0 address fffff02ah after reset ffh bit position bit name function 7, 5 to 0 pmctn (n = 7, 5 to 0) specifies input/output mode for pctn pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port ct mode control register (pmcct) this register can be read or written in 8-bit or 1-bit units. 7 pmcct7 pmcct 6 0 5 pmcct5 4 pmcct4 3 pmcct3 2 pmcct2 1 pmcct1 0 pmcct0 address fffff04ah after reset bfh bit position bit name function 7 pmcct7 specifies operation mode of pct7 pin. 0: i/o port mode 1: bcyst output mode 5 pmcct5 specifies operation mode of pct5 pin. 0: i/o port mode 1: we/wr output mode the we output mode and wr output mode are automatically selected by accessing the memory for which each mode is targeted. 4 pmcct4 specifies operation mode of pct4 pin. 0: i/o port mode 1: rd output mode 3 pmcct3 specifies operation mode of pct3 pin. 0: i/o port mode 1: uuwr output mode/uube output mode/uudqm output mode 2 pmcct2 specifies operation mode of pct2 pin. 0: i/o port mode 1: ulwr output mode/ulbe output mode/uldqm output mode 1 pmcct1 specifies operation mode of pct1 pin. 0: i/o port mode 1: luwr output mode/lube output mode/ludqm output mode 0 pmcct0 specifies operation mode of pct0 pin. 0: i/o port mode 1: llwr output mode/llbe output mode/lldqm output mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 853 (c) port ct function control register (pfcct) this register can be read or written in 8-bit or 1-bit units. cautions 1. when the port mode is specified by the port ct mode control register (pmcct), the setting of this register becomes invalid. 2. the timing of the xxdqm signal differs between when the xxwr output mode/xxdqm output mode is selected and when the xxbe output mode/xxdqm output mode is selected. however, if either mode is selected, no problems occur when connecting to sdram. for the output timing of the xxdqm signal, refer to the timing diagrams (figures 5-9 to 5-11) in 5.3.5 sdram access (xx = uu, ul, lu, ll). 7 0 pfcct 6 0 5 0 4 0 3 pfcct3 2 pfcct2 1 pfcct1 0 pfcct0 address fffff04bh after reset 00h bit position bit name function 3 pfcct3 specifies operation mode of pct3 pin in control mode. 0: uuwr output mode/uudqm output mode 1: uube output mode/uudqm output mode the uuwr output mode and uudqm output mode, and the uube output mode and uudqm output mode are automatically selected by accessing the memory for which each mode is targeted. 2 pfcct2 specifies operation mode of pct2 pin in control mode. 0: ulwr output mode/uldqm output mode 1: ulbe output mode/uldqm output mode the ulwr output mode and uldqm output mode, and the ulbe output mode and uldqm output mode are automatically selected by accessing the memory for which each mode is targeted. 1 pfcct1 specifies operation mode of pct1 pin in control mode. 0: luwr output mode/ludqm output mode 1: lube output mode/ludqm output mode the luwr output mode and ludqm output mode, and the lube output mode and ludqm output mode are automatically selected by accessing the memory for which each mode is targeted. 0 pfcct0 specifies operation mode of pct0 pin in control mode. 0: llwr output mode/lldqm output mode 1: llbe output mode/ludqm output mode the llwr output mode and lldqm output mode, and the llbe output mode and ludqm output mode are automatically selected by accessing the memory for which each mode is targeted.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 854 14.3.11 port cm port cm (pcm) is a 6-bit i/o port that can be set to the input or output mode in 1-bit units. 7 0 pcm 6 0 5 pcm5 4 pcm4 3 pcm3 2 pcm2 1 pcm1 0 pcm0 address fffff00ch after reset undefined bit position bit name function 5 to 0 pcmn (n = 5 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their function as port pins, in the control mode, the port cm pins operate as the wait insertion signal input, bus hold control signal output, refresh request signal output from sdram, and a/d converter external trigger input. (1) operation in control mode port alternate function remark block type pcm0 wait wait insertion signal input c-1 pcm1 ?? d-1 pcm2 hldak bus hold acknowledge signal output d-2 pcm3 hldrq bus hold request signal input c-1 pcm4 refrq refresh request signal output d-2 port cm pcm5 selfref/adtrg self-refresh request signal input f-5
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 855 (2) i/o mode/control mode setting the port cm i/o mode setting is performed by the port cm mode register (pmcm), and the control mode setting is performed by the port cm mode control register (pmccm) and the port cm function control register (pfccm). (a) port cm mode register (pmcm) this register can be read or written in 8-bit or 1-bit units. 7 1 pmcm 6 1 5 pmcm5 4 pmcm4 3 pmcm3 2 pmcm2 1 pmcm1 0 pmcm0 address fffff02ch after reset ffh bit position bit name function 5 to 0 pmcmn (n = 5 to 0) specifies input/output mode for pcmn pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port cm mode control register (pmccm) this register can be read or written in 8-bit or 1-bit units. be sure to clear bit 1 to 0. if it is set to 1, the operation is not guaranteed. 7 0 pmccm 6 0 5 pmccm5 4 pmccm4 3 pmccm3 2 pmccm2 1 0 0 pmccm0 address fffff04ch after reset 3dh bit position bit name function 5 pmccm5 specifies operation mode of pcm5 pin. 0: i/o port mode 1: selfref input mode/a/d converter external trigger (adtrg) input mode 4 pmccm4 specifies operation mode of pcm4 pin. 0: i/o port mode 1: refrq output mode 3 pmccm3 specifies operation mode of pcm3 pin. 0: i/o port mode 1: hldrq input mode 2 pmccm2 specifies operation mode of pcm2 pin. 0: i/o port mode 1: hldak output mode 0 pmccm0 specifies operation mode of pcm0 pin. 0: i/o port mode 1: wait input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 856 (c) port cm function control register (pfccm) this register can be read or written in 8-bit or 1-bit units. caution when the port mode is specified by the port cm mode control register (pmccm), the pfccm setting becomes invalid. 7 0 pfccm 6 0 5 pfccm5 4 0 3 0 2 0 1 0 0 0 address fffff04dh after reset 00h bit position bit name function 5 pfccm5 specifies operation mode of pcm5 pin in control mode. 0: selfref input mode 1: a/d converter external trigger (adtrg) input mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 857 14.3.12 port cd port cd (pcd) is a 4-bit i/o port that can be set to the input or output mode in 1-bit units. 7 0 pcd 6 0 5 0 4 0 3 pcd3 2 pcd2 1 pcd1 0 pcd0 address fffff00eh after reset undefined bit position bit name function 3 to 0 pcdn (n = 3 to 0) i/o port remark for reading/writing of the i/o port, see 14.5 operation of port function . in addition to their function as port pins, the port cd pins operate as the clock enable signal output, bus clock output, column address strobe signal output, and row address strobe signal output in the control mode. (1) operation in control mode port alternate function remark block type pcd0 sdcke clock enable signal output d-2 pcd1 busclk bus clock output d-1 pcd2 sdcas column address strobe signal output port cd pcd3 sdras row address strobe signal output d-2
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 858 (2) i/o mode/control mode setting the port cd i/o mode setting is performed by the port cd mode register (pmcd), and the control mode setting is performed by the port cd mode control register (pmccd). (a) port cd mode register (pmcd) this register can be read or written in 8-bit or 1-bit units. 7 1 pmcd 6 1 5 1 4 1 3 pmcd3 2 pmcd2 1 pmcd1 0 pmcd0 address fffff02eh after reset ffh bit position bit name function 3 to 0 pmcdn (n = 3 to 0) specifies input/output mode for pcdn pin. 0: output mode (output buffer on) 1: input mode (output buffer off) (b) port cd mode control register (pmccd) this register can be read or written in 8-bit or 1-bit units. 7 0 pmccd 6 0 5 0 4 0 3 pmccd3 2 pmccd2 1 pmccd1 0 pmccd0 address fffff04eh after reset 0fh bit position bit name function 3 pmccd3 specifies operation mode of pcd3 pin. 0: i/o port mode 1: sdras output mode 2 pmccd2 specifies operation mode of pcd2 pin. 0: i/o port mode 1: sdcas output mode 1 pmccd1 specifies operation mode of pcd1 pin. 0: i/o port mode 1: busclk output mode 0 pmccd0 specifies operation mode of pcd0 pin. 0: i/o port mode 1: sdcke output mode
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 859 14.4 configuration of reset, a2 to a15, and d0 to d15 pins the reset, a2 to a15, and d0 to d15 pins are not alternative function pins. their configuration is as follows. (1) configuration of reset, a2 to a15, and d0 to d15 pins pin function remark block type reset schmitt buffer n-1 a2 to a15 output buffer off control n-2 d0 to d15 output buffer off control and dir control n-3 (2) block diagram of reset, a2 to a15, and d0 to d15 pins figure 14-25. block diagram of type n-1 input signal reset figure 14-26. block diagram of type n-2 output buffer off signal note an internal bus note signal that becomes active in the idle and software stop modes, and by bus hold and reset remark n = 2 to 15
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 860 figure 14-27. block diagram of type n-3 output buffer off signal note output buffer off signal dn internal bus note signal that becomes active in the idle and software stop modes, and by bus hold and reset remark n = 0 to 15
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 861 14.5 operation of port function the operation of a port differs depending on whether it is set in the input or output mode, as follows. 14.5.1 writing to i/o port (1) in output mode a value can be written to the output latch (pn) by writing it to the port n register (pn). the contents of the output latch are output from the pin. once data is written to the output latch, it is held until new data is written to the output latch. (2) in input mode a value can be written to the output latch (pn) by writing it to the port n register (pn). however, the status of the pin does not change because the output buffer is off. once data is written to the output latch, it is held until new data is written to the output latch. caution a bit manipulation instruction (clr1, set1, not1) manipulates 1 bit but accesses a port in 8-bit units. if this instruction is executed to manipulate a port with a mixture of input and output bits, the contents of the output latch of a pin set in the input mode, in addition to the bit to be manipulated, are overwritten to the current input pin status and become undefined. 14.5.2 reading from i/o port (1) in output mode the contents of the output latch (pn) can be read by reading the port n register (pn). the contents of the output latch do not change. (2) in input mode the status of the pin can be read by reading the port n register (pn). the contents of the output latch (pn) do not change. 14.5.3 output status of alternate function in control mode the status of a port pin is not dependent upon the setting of the pmcn register and can be read by setting the port n mode register (pmn) to the input mode. if the pmn register is set to the output mode, the value of the port n register (pn) can be read in the port mode, and the output status of the alternate function can be read in the control mode.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 862 14.6 noise eliminator 14.6.1 interrupt input pin the following timing controller used to secure the noise elimination time is provided for the nmi and port pins that operate in the control mode when the valid edge is input. input signals that change within the noise elimination time are not internally acknowledged. table 14-1. noise elimination time of interrupt input pins pin noise elimination time nmi intp10 intp11 intp21 intp22 intp23 intp24 intp25 intp50 intp51 intp52 intp65 intp66 intp67 intpl0 intpl1 intpd0 intpd1 intpd2 intpd3 intpd4 intpd5 intpd6 intpd7 intpd8 intpd9 intpd10 intpd11 intpd12 intpd13 intpd14 intpd15 analog delay (80 ns typ.) cautions 1. the above non-maskable and maskable interrupt pins are used to release the standby mode. a timing circuit that controls the clock is not employed because the internal system clock is stopped in the standby mode. 2. the noise eliminator is valid only in the control mode.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 863 14.6.2 a/d converter input pin the following timing controller used to secure the noise elimination time is provided for the adtrg pin. an input signal that changes within the noise elimination time is not internally acknowledged. table 14-2. noise elimination time of a/d converter input pin pin noise elimination time pcm5/adtrg/selfref analog delay (80 ns typ.) caution the noise eliminator is valid only in the control mode. 14.6.3 timer c and timer enc1 input pins the following noise filter that operates via clock sampling is provided for the pins of timers c and enc1 that operate when the valid edge is input. input signals that change within the noise elimination time are not internally acknowledged. table 14-3. noise elimination time of timer c and timer enc1 input pins pin noise elimination time intpc00/tic0 intpc01 intpc10/tic1 intpc11 intpc20/tic2 intpc21 intpc30/tic3 intpc31 intp100/tcud10 intp101/tclr10 tiud10 intp110/tcud11 intp111/tclr11 tiud11 selected from 0, 2, 3, or 5 clocks cautions 1. the noise filter of the above pins cannot acknowledge an input signal when the cpu clock is stopped because it uses clock sampling. 2. the noise eliminator is valid only in the control mode.
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 864 (1) noise elimination width setting registers c0 to c3 (ncwc0 to ncwc3) these registers are used to set the noise elimination width of the digital noise filter of the timer c input pins. these registers can be read or written in 8-bit units. be sure to clear bits 7 to 2 to 0. if they are set to 1, the operation is not guaranteed. 7 0 0 0 0 ncwc0 ncwc1 ncwc2 ncwc3 6 0 0 0 0 5 0 0 0 0 4 0 0 0 0 3 0 0 0 0 2 0 0 0 0 1 nccc01 nccc11 nccc21 nccc31 0 nccc00 nccc10 nccc20 nccc30 address fffff610h ffff630h fffff650h fffff670h after reset 02h 02h 02h 02h bit position bit name function specify number of clocks from which noise is to be eliminated. ncccn1 ncccn0 number of clocks from which noise is to be eliminated 0 0 0 (through input) 012 103 115 1, 0 ncccn1, ncccn0 remark 1 clock = f x /4 f x : main clock remark n = 0 to 3
chapter 14 port functions preliminary user ? s manual u16031ej2v1ud 865 (2) noise elimination width setting registers 10, 11 (ncw10, ncw11) these registers are used to set the noise elimination width of the digital noise filter of the timer enc1 input pins. these registers can be read or written in 8-bit units. cautions 1. whether the signal is input through or inverted can be specified for each of the intp1n0/tcud1n and tiud1n pins. the noise elimination width set by the ncfn, ncc1n, and ncc0n bits is for each timer and cannot be changed for each pin. 2. the setting of the srtcn bit is valid even when the intp1n0/tcud1n pin is used as a capture trigger (intp1n0). 7 0 ncw10 6 0 5 srtc0 4 srti0 3 0 2 ncf0 1 ncc10 0 ncc00 address fffff5c0h after reset 02h 0 ncw11 0 srtc1 srti1 0 ncf1 ncc11 ncc01 fffff5f0h 02h bit position bit name function 5 srtcn specifies the input mode of the intp1n0/tcud1n pin. 0: through input 1: inverted this bit specifies whether the signal input from the intp1n0/tcud1n pin is input through to tmenc1n, or inverted. 4 srtin specifies the input mode of the tiud1n pin. 0: through input 1: inverted this bit specifies whether the signal input from the tiud1n pin is input through to tmenc1n, or inverted. 2 ncfn specifies the clock frequency for noise elimination. 0: f x /4 1: f x /32 this bit selects a clock source for the noise filter. specify the number of clocks from which noise is to be eliminated. ncc1n ncc0n number of clocks from which noise is to be eliminated 0 0 0 (through input) note 012 103 115 1, 0 ncc1n, ncc0n note clear the ncfn bit to 0 to input the signal through. these bits are used to select the number of clocks from which noise is to be eliminated. remark n = 0, 1
chapter 14 port functions preliminary user?s manual u16031ej2v1ud 866 (a) relationship between ncw1n register set value and noise elimination width table 14-4. relationship between ncw1n register set value and noise elimination width ncw1n register noise elimination width (ns) ncfn bit ncc1n bit ncc0n bit f x = 150 mhz f x = 133 mhz f x = 100 mhz remark 000000thr ough 0 0 1 53.3 to 80.0 60.2 to 90.2 80 to 120 (1/(f x /4)) 2 0 1 0 80.0 to 106.7 90.2 to 120.3 120 to 160 (1/(f x /4)) 3 0 1 1 133.3 to 160.0 150.4 to 180.5 200 to 240 (1/(f x /4)) 5 100000thr ough 1 0 1 426.7 to 640.0 481.2 to 721.8 640 to 960 (1/(f x /32)) 2 1 1 0 640.0 to 853.3 721.8 to 962.9 960 to 1,280 (1/(f x /32)) 3 1 1 1 1,066.7 to 1,280.0 1,203.0 to 1,443.6 1,600 to 1,920 (1/(f x /32)) 5 remarks 1. n = 0, 1 2. f x : main clock
preliminary user?s manual u16031ej2v1ud 867 chapter 15 reset functions 15.1 overview ? reset function by reset input ? forced reset function by dcu (see chapter 16 debug function (dcu) .) ? low level is input to the reset pin for 100 s min. if an oscillation stabilization time of 100 s or longer is necessary, secure the low level for as long as the necessary oscillation stabilization time. ? reset generator (rg) eliminates noise from the reset pin. 15.2 configuration reset peripheral reset rg cpu core v850e/me2 selector sscg dcu remark sscg: spread spectrum frequency synthesizer phase locked loop (see chapter 8 clock generation function ) dcu: debug control unit (see chapter 16 debug function ) rg: reset generator during a system reset, most pins (all excluding the busclk, reset, x2, ev dd , ev ss , iv dd , iv ss , pllv dd , pllv ss , oscv dd , oscv ss , uv dd , av dd , av refp , av refm , and av ss pins) enter the high-impedance state. therefore, a pull-up (or pull-down) resistor must be connected to each pin of the address bus, data bus, and external bus control signals. if no resistor is connected, external memory may be destroyed when these pins enter the high-impedance state. for the same reason, the output signals of the on-chip peripheral i/o functions and other output ports should be handled in the same manner.
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 868 15.3 operation when a low-level signal is input to the reset pin, a system reset is effected and each on-chip hardware is initialized. when the reset pin level changes from low to high, the reset state is released and the cpu starts program execution using osc output clock (f x ). register contents must be initialized as required in the program. when the reset signal is cleared, the oscillation stabilization time is not inserted. when the reset signal is to be input (reset input on power application or reset input when the software stop mode is released) while the clock oscillator is stopped, therefore, a low-level width longer than the oscillation stabilization time (100 s min.) must be secured at the reset pin. when the reset signal is to be input (reset input when the idle mode is released) while the clock oscillator is not stopped, a low level of 100 s min. must be secured at the reset pin. table 15-1. hardware status at reset hardware during reset period after reset is cleared osc oscillation/supply continues clock generator ? outputs osc clock (f x ) ? output is not guaranteed before oscillation stabilization time. ? outputs osc clock (f x ) ? operable at f x = f x 8 by controlling the cks register cpu stops operating starts operating internal instruction ram, internal data ram undefined debug function stops operating operable on-chip peripheral i/o registers initialized to specific status on-chip peripheral functions other than above stops operating can start operating pin function see 2.2 pin status .
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 869 the reset operation when the reset pin is input is illustrated below. figure 15-1. reset operation with reset pin input (1/2) (a) when idle mode is released power supply voltage h osc output clock (f x ) operation at f x = f x 8 (sscg output) initialized to operation at f x = f x (osc output) analog delay (eliminated as noise) analog delay (eliminated as noise) analog delay analog delay cpu operation starts. 5 system clocks min. sscg output stabilized (lock = 0) lock = 0 ckssel = 1 100 s min. secured internal system clock reset (input) internal system reset pll lockup time (2 ms min.) caution secure the sscg initialization time (100 s) by the low-level width of the reset signal. remark lock: bit 1 of lockr register ckssel: bit 1 of cks register
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 870 figure 15-1. reset operation with reset pin input (2/2) (b) when software stop mode is released power supply voltage h osc output clock (f x ) operation at f x = f x 8 (sscg output) initialized to operation at f x = f x (osc output) analog delay (eliminated as noise) analog delay (elimintaed as noise) analog delay analog delay cpu operation starts. 5 system clocks min. sscg output stabilized (lock = 0) lock = 0 ckssel = 1 oscillation stabilization time (100 s min.) secured internal system clock reset (input) internal system reset pll lockup time (2 ms min.) caution secure the oscillation stabilization time and sscg initialization time (100 s) by the low-level width of the reset signal. remark lock: bit 1 of lockr register ckssel: bit 1 of cks register
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 871 the power-on reset operation is illustrated below. figure 15-2. power-on reset operation power supply voltage osc output clock (f x ) operation at f x = f x 8 (sscg output) initialized to operation at f x = f x (osc output) analog delay (eliminated as noise) analog delay cpu operation starts. 5 system clocks min. sscg output stabilized (lock = 0) lock = 0 ckssel = 1 oscillation stabilization time (100 s min.) secured internal system clock reset (input) internal system reset pll lockup time (2 ms min.) cautions 1. secure the oscillation stabilization time and sscg initialization time (100 s) by the low- level width of the reset signal. 2. supply power in the order of iv dd (internal power supply) and ev dd (external power supply). remark lock: bit 1 of lockr register ckssel: bit 1 of cks register
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 872 the busclk operation at power-on reset is illustrated below. figure 15-3. busclk operation at power-on reset power supply voltage osc output clock (f x ) osc output insufficient osc output stabilized pll lockup time (2 ms min.) f x = f x 8 (sscg output) f x = f x (osc output) sscg output stabilized (lock = 0) internal system clock reset (input) busclk note <1> <2> <3> <4> <5> <6> remarks 1. <1>: power on <2>: osc oscillation stabilization <3>: reset cleared (counting of pll lockup time starts) <4>: pll lock status (lock bit of lockr register = 0) <5>: busclk = f clk /2 (ckm1 and ckm0 bits of bmc register = 01) <6>: set to f x = f x 8 (ckssel bit of cks register = 1) 2. the above operation is when busclk operates on 1/2 the cycle of the internal system clock (f clk ).
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 873 15.4 initialization initialize the contents of each register as necessary while programming. the initial values of the cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after a reset are shown below. table 15-2. initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset (1/6) internal hardware register name initial value after reset general-purpose register (r0) 00000000h general-purpose register (r1 to r31) undefined program registers program counter (pc) 00100000h status saving registers during interrupt (eipc, eipsw) undefined status saving registers during nmi (fepc, fepsw) undefined interrupt source register (ecr) 00000000h program status word (psw) 00000020h status saving registers during callt execution (ctpc, ctpsw) undefined status saving registers during exception/debug trap (dbpc, dbpsw) undefined callt base pointer (ctbp) undefined debug interface register (dir) 00000040h breakpoint control registers 0, 1 (bpc0, bpc1) undefined program id register (asid) undefined breakpoint address setting registers 0, 1 (bpav0, bpav1) undefined breakpoint address mask registers 0, 1 (bpam0, bpam1) undefined breakpoint data setting registers 0, 1 (bpdv0, bpdv1) undefined cpu system registers breakpoint data mask registers 0, 1 (bpdm0, bpdm1) undefined internal instruction ram, internal data ram ? undefined chip area select control register n (cscn) (n = 0, 1) 2c11h bus cycle type configuration register n (bctn) (n = 0, 1) 8888h local bus sizing control register (lbs) 5555h/aaaah note 1 endian configuration register (bec) 0000h line buffer control register n (lbcn) (n = 0, 1) 0000h bus mode control register (bmc) 00h data wait control register n (dwcn) (n = 0, 1) 7777h address setup wait control register (asc) ffffh bus cycle period control register (bcp) 00h dma flyby transfer wait control register (fwc) 7777h bus cycle control register (bcc) ffffh dma flyby transfer idle control register (fic) 3333h cache configuration register (bhc) 0000h instruction cache control register (icc) 0003h note 2 instruction cache control register l (iccl) 03h note 2 on-chip peripheral i/o bus control functions instruction cache control register h (icch) 00h notes 1. for details, see 4.5.2 (1) local bus sizing control register (lbs) . 2. for details, see 4.9.4 (1) instruction cache control register (icc) .
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 874 table 15-2. initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset (2/6) internal hardware register name initial value after reset instruction cache data configuration register (icd) undefined internal instruction ram mode register (iramm) 03h bus control functions system wait control register (vswc) 77h page rom configuration register (prc) 7000h sdram configuration register n (scrn) (n = 1, 3, 4, 6) 30c0h memory control functions sdram refresh control register n (rfsn) (n = 1, 3, 4, 6) 0000h dma source address register nh (dsanh) (n = 0 to 3) undefined dma source address register nl (dsanl) (n = 0 to 3) undefined dma destination address register nh (ddanh) (n = 0 to 3) undefined dma destination address register nl (ddanl) (n = 0 to 3) undefined dma transfer count register n (dbcn) (n = 0 to 3) undefined dma addressing control register n (dadcn) (n = 0 to 3) 0000h dma channel control register n (dchcn) (n = 0 to 3) 00h dma terminal count output control register (dtoc) 01h dma trigger factor register n (dtfrn) (n = 0 to 3) 00h dma functions dma interface control register (difc) 00h interrupt control registers (p1ic0, p1ci1, p2ic1 to p2ic5, p5ic0 to p5ic2, p6ic5 to p6ic7, pdic0 to pdic15, plic0, plic1, ovcic0 to ovcic5, ccc0ic0, ccc0ic1, ccc1ic0, ccc1ic1, ccc2ic0, ccc2ic1, ccc3ic0, ccc3ic1, ccc4ic0, ccc4ic1, ccc5ic0, ccc5ic1, cmdic0 to cmdic3, cc10ic0, cc10ic1, cc11ic0, cc11ic1, cm10ic0, cm10ic1, cm11ic0, cm11ic1, ov1ic0, ov1ic1, ud1ic0, ud1ic1, dmaic0 to dmaic3, csi3ic0, csi3ic1, covf3ic0, covf3ic1, ureic0, ureic1, uric0, uric1, utic0, utic1, uific0, uific1, utoic0, utoic1, adic, us0bic to us2bic, usp2ic, usp4ic, rsumic) 47h interrupt mask register n (imrn) (n = 0 to 5) ffffh interrupt mask register nl (imrnl) (n = 0 to 5) ffh interrupt mask register nh (imrnh) (n = 0 to 5) ffh nmi reset status register (nrs) 00h in-service priority register (ispr) 00h external interrupt falling edge specification register n (intfn) (n = 1, 2, 5, 6, al) 00h external interrupt falling edge specification register dh (intfdh) 0000h external interrupt falling edge specification register dhl (intfdhl) 00h external interrupt falling edge specification register dhh (intfdhh) 00h external interrupt rising edge specification register n (intrn) (n = 1, al) 03h external interrupt rising edge specification register 2 (intr2) 3fh external interrupt rising edge specification register 5 (intr5) 07h external interrupt rising edge specification register 6 (intr6) e0h external interrupt rising edge specification register dh (intrdh) ffffh external interrupt rising edge specification register dhl (intrdhl) ffh external interrupt rising edge specification register dhh (intrdhh) ffh valid edge select register cn (sescn) (n = 0 to 3) 00h on-chip peripheral i/o interrupt/exception control functions valid edge select register 1n (sesa1n) (n = 0, 1) 00h
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 875 table 15-2. initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset (3/6) internal hardware register name initial value after reset clock control register (ckc) 03h clock source select register (cks) 00h sscg control register (sscgc) see 8.3.3 usb clock control register (uckc) 00h lock register (lockr) 01h oscillation stabilization time select register (osts) 04h power-save mode register (psmr) 00h clock generation functions power-save control register (psc) 00h system control command register (prcmd) undefined timer cn (tmcn) (n = 0 to 5) 0000h capture/compare registers cn0, cn1 (cccn0, cccn1) (n = 0 to 5) 0000h timer mode control register cn0 (tmccn0) (n = 0 to 5) 00h timer mode control register cn1 (tmccn1) (n = 0 to 5) 20h valid edge select register cn (sescn) (n = 0 to 3) 00h timer/counter functions (timer c) noise elimination width setting register cn (ncwcn) (n = 0 to 3) 02h timer dn (tmdn) (n = 0 to 3) 0000h compare register dn (cmdn) (n = 0 to 3) 0000h timer/counter functions (timer d) timer mode control register dn (n = 0 to 3) 00h timer enc1n (tmenc1n) (n = 0, 1) 0000h compare register 1n (cm1n) (n = 00, 01, 10, 11) 0000h capture/compare register 1n (cc1n) (n = 00, 01, 10, 11) 0000h timer unit mode register 1n (tum1n) (n = 0, 1) 00h timer control register 1n (tmc1n) (n = 0, 1) 00h capture/compare control register 1n (ccr1n) (n = 0, 1) 00h valid edge select register 1n (sesa1n) (n = 0, 1) 00h prescaler mode register 1n (prm1n) (n = 0, 1) 07h status register 1n (status1n) (n = 0, 1) 00h timer/counter functions (timer enc1) noise elimination width setting register 1n (ncw1n) (n = 0, 1) 02h uf0 ep0nak register (uf0e0n) 00h uf0 ep0nakall register (uf0e0na) 00h uf0 epnak register (uf0en) 00h uf0 epnak mask register (uf0enm) 00h uf0 sndsie register (uf0sds) 00h uf0 clr request register (uf0clr) 00h uf0 set request register (uf0set) 00h uf0 ep status n register (uf0epsn) (n = 0 to 2) 00h uf0 int status n register (uf0isn) (n = 0 to 4) 00h uf0 int mask n register (uf0imn) (n = 0 to 4) 00h uf0 int clear n register (uf0icn) (n = 0 to 4) ffh uf0 int & dmarq register (uf0idr) 00h uf0 dma status n register (uf0dmsn) (n = 0, 1) 00h on-chip peripheral i/o serial interface functions (usbf) uf0 fifo clear n register (uf0ficn) (n = 0, 1) 00h
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 876 table 15-2. initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset (4/6) internal hardware register name initial value after reset uf0 data end register (uf0dend) 00h uf0 gpr register (uf0gpr) 00h uf0 mode control register (uf0modc) 00h uf0 mode status register (uf0mods) 00h uf0 active interface number register (uf0aifn) 00h uf0 active alternative setting register (uf0aas) 00h uf0 alternative setting status register (uf0ass) 00h uf0 endpoint n interface mapping register (uf0enim) (n = 1 to 4, 7, 8) 00h uf0 ep0 read register (uf0e0r) undefined uf0 ep0 length register (uf0e0l) 00h uf0 ep0 setup register (uf0e0st) 00h uf0 ep0 write register (uf0e0w) undefined uf0 bulk out n register (uf0bon) (n = 1, 2) undefined uf0 bulk out n length register (uf0bo1l) (n = 1, 2) 00h uf0 bulk in n register (uf0bin) (n = 1, 2) undefined uf0 interrupt n register (uf0intn) (n = 1, 2) undefined uf0 device status register l (uf0dstl) 00h uf0 epn status register l (uf0ensl) (n = 0 to 4, 7, 8) 00h uf0 address register (uf0adrs) 00h uf0 configuration register (uf0cnf) 00h uf0 interface n register (uf0ifn) (n = 0 to 4) 00h uf0 descriptor length register (uf0dscl) 00h uf0 device descriptor register n (uf0ddn) (n = 0 to 17) 00h uf0 configuration/interface/endpoint descriptor register n (uf0cien) (n = 0 to 255) undefined usb function 0 dma channel select register (uf0cs) 0000h serial interface functions (usbf) usb function 0 buffer control register (uf0bc) 00h uartbn control register 0 (ubnctl0) (n = 0, 1) 10h uartbn control register 2 (ubnctl2) (n = 0, 1) ffffh uartbn status register (ubnstr) (n = 0, 1) 00h uartbn transmit data register (ubntx) (n = 0, 1) ffh uartbn receive data register ap (ubnrxap) (n = 0, 1) 00ffh uartbn receive data register (ubnrx) (n = 0, 1) ffh uartbn fifo control register 0 (ubnfic0) (n = 0, 1) 00h uartbn fifo control register 1 (ubnfic1) (n = 0, 1) 00h uartbn fifo control register 2 (ubnfic2) (n = 0, 1) 0000h uartbn fifo control register 2l (ubnfic2l) (n = 0, 1) 00h uartbn fifo control register 2h (ubnfic2h) (n = 0, 1) 00h uartbn fifo status register 0 (ubnfis0) (n = 0, 1) 00h on-chip peripheral i/o serial interface functions (uartb) uartbn fifo status register 1 (ubnfis1) (n = 0, 1) 10h
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 877 table 15-2. initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset (5/6) internal hardware register name initial value after reset clocked serial interface mode register 3n (csim3n) (n = 0, 1) 00h clocked serial interface clock select register 3n (csic3n) (n = 0, 1) 07h receive data buffer register 3n (sirb3n) (n = 0, 1) 0000h receive data buffer register 3nl (sirb3nl) (n = 0, 1) 00h receive data buffer register 3nh (sirb3nh) (n = 0, 1) 00h transmit data csi buffer register 3n (sfdb3n) 0000h transmit data csi buffer register 3nl (sfdb3nl) 00h transmit data csi buffer register 3nh (sfdb3nh) 00h csibuf status register 3n (sfa3n) (n = 0, 1) 20h transfer data length select register 3n (csil3n) (n = 0, 1) 00h serial interface functions (csi3) transfer data number specification register 3n (sfn3n) (n = 0, 1) 00h a/d converter mode register n (admn) (n = 0 to 2) 00h adc trigger select register (adts) 00h a/d conversion result register n (adcrn) (10 bits) (n = 0 to 7) undefined a/d converter a/d conversion result register nh (adcrnh) (8 bits) (n = 0 to 7) undefined pwm control register n (pwmcn) (n = 0, 1) 08h pwm modulo register n (pwmn) (n = 0, 1) 0000h pwm modulo register ln (pwmln) (n = 0, 1) 00h pwm pwm modulo register hn (pwmhn) (n = 0, 1) 00h ports (p1, p2, p5 to p7, pcs, pct, pcm, pcd) undefined port (pal) undefined port (pall) undefined port (palh) undefined port (pah) undefined port (pahl) undefined port (pahh) undefined port (pdh) undefined port (pdhl) undefined port (pdhh) undefined mode register (pm1, pm2, pm5 to pm7, pmcs, pmct, pmcm, pmcd) ffh mode register (pmal) ffffh mode register (pmall) ffh mode register (pmalh) ffh mode register (pmah) ffffh mode register (pmahl) ffh mode register (pmahh) ffh mode register (pmdh) ffffh mode register (pmdhl) ffh mode register (pmdhh) ffh mode control register (pmc1, pmc5 to pmc7) 00h mode control register (pmc2) 01h on-chip peripheral i/o port functions mode control register (pmccs) ffh
chapter 15 reset functions preliminary user ? s manual u16031ej2v1ud 878 table 15-2. initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset (6/6) internal hardware register name initial value after reset mode control register (pmcct) bfh mode control register (pmccm) 3dh mode control register (pmccd) 0fh mode control register (pmcal) 0002h mode control register (pmcall) 02h mode control register (pmcalh) 00h mode control register (pmcah) 03ffh mode control register (pmcahl) ffh mode control register (pmcahh) 03h mode control register (pmcdh) 0000h mode control register (pmcdhl) 00h mode control register (pmcdhh) 00h function control registers (pfc1, pfc2, pfc5 to pfc7, pfccs, pfcct, pfccm) 00h function control register l (pfcall) 03h function control register (pfcdh) 0000h function control register (pfcdhl) 00h function control register (pfcdhh) 00h external interrupt falling edge specification register n (intfn) (n = 1, 2, 5, 6, al) 00h external interrupt falling edge specification register dh (intfdh) 0000h external interrupt falling edge specification register dhl (intfdhl) 00h external interrupt falling edge specification register dhh (intfdhh) 00h external interrupt rising edge specification register n (intrn) (n = 1, al) 03h external interrupt rising edge specification register 2 (intr2) 3fh external interrupt rising edge specification register 5 (intr5) 07h external interrupt rising edge specification register 6 (intr6) e0h external interrupt rising edge specification register dh (intrdh) ffffh external interrupt rising edge specification register dhl (intrdhl) ffh external interrupt rising edge specification register dhh (intrdhh) ffh noise elimination width setting register cn (ncwcn) (n = 0 to 3) 02h on-chip peripheral i/o port functions noise elimination width setting register 1n (ncw1n) (n = 0, 1) 02h caution ?undefined? in the above table is undefined after power-on-reset, or undefined as a result of data destruction when reset is input and the data write timing has been synchronized. for other reset signals, data is held in the same state it was in before the reset operation.
preliminary user?s manual u16031ej2v1ud 879 chapter 16 debug function (dcu) the debug control unit (dcu) consists of three function units: an execution control unit (rcu) that realizes communication with jtag and execution of debug processing, a trace control unit (trcu) that implements trace functions, and a trigger event unit (teu) that implements event detection functions. on-chip debugging of the v850e/me2 can be executed by connecting an n-wire type ie. caution the debug function is supported by the v850e/me2, but whether this function can be used or not depends on the debugger used. 16.1 functional outline 16.1.1 debug function (1) debug interface this interface establishes communication with the host machine by using the drst, dck, dms, ddi, and ddo signals, via an n-wire type ie. the communication specifications of jtag are used for this interface. it does not support a boundary scan function. (2) on-chip debug on-chip debugging can be performed if wiring and connectors for debugging are provided on the target system. connect an n-wire type ie to the connector for debugging. (3) forced reset function the v850e/me2 can be forcibly reset. (4) break reset function the cpu can be started in the debug mode immediately after resetting the cpu has been cleared. (5) forced break function execution of the user program can be forcibly stopped (however, the handler of the illegal instruction code exception (first address: 00000060h) cannot be used). (6) debug monitor function during debugging, a memory space for debugging, different from the user memory space, is used (background monitor format). the user program can be executed starting from any address. while execution of the user program is stopped, the user resources (such as memory and i/o) can be read/written, and the user program can be downloaded.
chapter 16 debug function (dcu) preliminary user?s manual u16031ej2v1ud 880 (7) mask function (a) nmi and all maskable interrupt request signals can be masked. (b) when the debugger is connected, the reset pin input on the target board is masked by default (the reset pin input is masked when the debugger is started after power application to the v850e/me2). the reset pin input can be unmasked from the debugger. if a signal is input to the reset pin during debugging (during run execution), however, the following problems may occur. ? the break function may malfunction. if this happens, restart. ? trace data may be illegal before and after reset pin input. recovery will occur after the reset signal has been released. 16.1.2 trace function (1) pc trace (branch trace) function all branches (transition of processing) that occur during user program execution can be traced. the trace sources can be selected from 12 types of branch sources that are classified by function, and pc trace can be started from execution of an instruction at any address, and the trace source can be changed. two trace start triggers are available. (2) data trace function a data access issued by the cpu to any address can be traced in a range of 1 kb to 4 bytes. read or written data can be traced, and two data trace points are available. however, a data access issued by the dmac cannot be traced. (3) real-time trace mode branch and data access can be traced during real-time execution of the user program. the trace packet of the trace source detected is stored in a trace buffer, and output from trace interface pins (trcclk, trcdata0 to trcdata3, and trcend) (some trace packets may not be traced if no more trace packets can be stored in the trace buffer). (4) full trace mode (non-real-time trace mode) all branches and data accesses of the user program can be traced. in the full trace mode, the pipeline of the cpu is temporarily held and instruction execution is stopped to secure the time of trace data output from trace interface pins, so that all trace packets can be correctly traced.
chapter 16 debug function (dcu) preliminary user?s manual u16031ej2v1ud 881 16.1.3 event function (1) instruction event detection function event detection (10 events) via size comparison by the execution pc and range event detection (up to four pairs with each pair consisting of two events) of the execution pc can be executed. if an instruction event source is used as a break source, two breakpoints before execution of the instruction at which an event is detected and eight breakpoints after instruction execution can be detected. (2) access event detection function events can be detected as follows. ? comparison of access addresses (4 addresses) ? range of access address (up to two pairs with each pair consisting of two addresses) ? match or mismatch of access data ? data of specific bit by masking data ? access size an access event source is detected after access. if an access event source is used as a break source, a break occurs after several instructions have been executed after the instruction that issued the access that caused event detection. (3) sequential event detection function an event can be detected when up to four stages of events have successively occurred or an event that clears successive occurrence of events can be detected. sequential events can be counted by using a 12-bit pass counter.
chapter 16 debug function (dcu) preliminary user?s manual u16031ej2v1ud 882 16.2 connection with n-wire type ie a connector for the ie and a connection circuit must be provided on the target system. figure 16-1. connecting n-wire type ie to host machine high-speed n-wire emulator target system mictor connector (plug) (amp) mictor connector (receptacle (2-767004-2)) (amp)
chapter 16 debug function (dcu) preliminary user ? s manual u16031ej2v1ud 883 16.2.1 ie connector (on target system side) the following table shows the pin functions of the ie connector (on the target system side). table 16-1. ie connector pin function (on target system side) pin no. pin name i/o pin function 1gnd ?? 2gnd ?? 3 dck output clock output for debug serial interface 4v dd ? +3.3 v input (for monitoring power to target) 5 dms output transfer mode select output for debug serial interface 6 drst output dcu reset output 7 ddi output data output for debug serial interface 8 port0_out output general-purpose control signal 0 output 9 ddo input data input for debug serial interface 10 port1_out output general-purpose control signal 1 output 11 (reserved 1) ? (leave this pin open) 12 port2_out output general-purpose control signal 2 output 13 (reserved 2) ? (leave this pin open) 14 port0_in input general-purpose control signal 0 input 15 (reserved 3) ? (leave this pin open) 16 port1_in input general-purpose control signal 1 input 17 trcclk input trace clock input 18 port2_in input general-purpose control signal 2 input 19 trcend input trace data end input 20 trcce input trace packet compression enable signal input 21 trcdata0 input trace data 0 input 22 trcdata8 input trace data 8 input 23 trcdata1 input trace data 1 input 24 trcdata9 input trace data 9 input 25 trcdata2 input trace data 2 input 26 trcdata10 input trace data 10 input 27 trcdata3 input trace data 3 input 28 trcdata11 input trace data 11 input 29 trcdata4 input trace data 4 input 30 trcdata12 input trace data 12 input 31 trcdata5 input trace data 5 input 32 trcdata13 input trace data 13 input 33 trcdata6 input trace data 6 input 34 trcdata14 input trace data 14 input 35 trcdata7 input trace data 7 input 36 trcdata15 input trace data 15 input 37 gnd ?? 38 gnd ?? remark cautions are given on the next page.
chapter 16 debug function (dcu) preliminary user ? s manual u16031ej2v1ud 884 cautions 1. the connection of pins not supported by the v850e/me2 depends on the ice used. 2. the pattern on the target board must satisfy the following conditions to support high-speed interfacing. ? ? ? ? lay out the pattern with the odd pins facing the device (v850e/me2). ? ? ? ? keep the pattern length to within 1.97 inches (50 mm). ? ? ? ? shield the clock signal with gnd. v850e/me2 mictor connector (receptacle (2-767004-2)) 2 38 1 37 16.2.2 recommended circuit example the following figure shows an example of the recommended circuit of the ie connector (on the target system side). figure 16-2. example of recommended ie connection circuit v850e/me2 dck dms ddi ddo drst trcclk trcend trcdata0 trcdata1 trcdata2 trcdata3 note 2 note 1 note 1 note 1 note 1 note 2 22 ? 22 ? 50 k ? 50 k ? 50 k ? 50 k ? 50 k ? 50 k ? 50 k ? 50 k ? 50 k ? 50 k ? 50 k ? 50 k ? note 1 22 ? note 1 22 ? note 1 22 ? note 1 22 ? note 1 22 ? dck dms ddi ddo (reserved 1) (reserved 2) (reserved 3) trcclk trcend trcdata0 trcdata1 trcdata2 trcdata3 trcdata4 trcdata5 trcdata6 trcdata7 gnd gnd v dd note 3 drst port0_out port1_out port2_out port0_in port1_in port2_in trcce trcdata8 trcdata9 trcdata10 trcdata11 trcdata12 trcdata13 trcdata14 trcdata15 gnd (open) (open) (open) +3.3 v +3.3 v 4.7 k ? 50 k ? 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 1, 37 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 2, 38 ground bus mictor connector (receptacle) 2-767004-2 notes 1. keep the pattern length to within 1.97 inches (50 mm). 2. shield the dck and trcclk signals by gnd. 3. for detecting power to the target board caution the recommended circuit example shown above assumes that a 3.3 v interface is used.
885 preliminary user?s manual u16031ej2v1ud chapter 17 electrical specifications (target values) absolute maximum ratings (t a = 25 c) parameter symbol conditions ratings unit iv dd iv dd pin ? 0.5 to +2.0 v iv ss iv ss pin ? 0.5 to +0.5 v ev dd ev dd pin, ev dd iv dd ? 0.5 to +4.6 v ev ss ev ss pin ? 0.5 to +0.5 v oscv dd oscv dd pin ? 0.5 to +4.6 v oscv ss oscv ss pin ? 0.5 to +0.5 v pllv dd pllv dd pin ? 0.5 to +2.0 v pllv ss pllv ss pin ? 0.5 to +0.5 v uv dd uv dd pin ? 0.5 to +4.6 v av dd av dd pin, av dd < ev dd 0.5 v ? 0.5 to +4.6 v supply voltage av ss av ss pin ? 0.5 to +0.5 v input voltage v i except for x1 pin , v i < ev dd + 0.3 v ? 0.5 to +4.6 v clock input voltage v k x1 pin ? 0.5 to oscv dd + 0.5 note v per pin 4.0 ma output current, low i ol total of all pins 100 ma per pin ? 4.0 ma output current, high i oh total of all pins ? 100 ma output voltage v o ev dd = 3.3 v 0.3 v ? 0.5 to ev dd + 0.5 note v analog input voltage v wasn ani0 to ani7 pins , av dd = 3.3 v 0.3 v ? 0.3 to av dd + 0.3 note v av refp ? 0.3 to av dd + 0.3 note v a/d converter reference input voltage av refm ? 0.3 to +0.3 v 30 pf < output pin load capacitance 50 pf ? 40 to +70 c operating ambient temperature t a output pin load capacitance 30 pf ? 40 to +85 c storage temperature t stg ? 60 to +150 c note be sure not to exceed the absolute maximum ratings (max. value) of each supply voltage. cautions 1. do not directly connect the output (or i/o) pins of ic products to each other, or to iv dd , ev dd , and gnd. direct connection of the output pins between an ic product and an external circuit is possible, if the output pins can be set to the high-impedance state and the output timing of the external circuit is designed to avoid output conflict. 2. product quality may suffer if the absolute maximum rating is exceeded even momentarily for any parameter. that is, the absolute maximum ratings are rated values at which the product is on the verge of suffering physical damage, and therefore the product must be used under conditions that ensure that the absolute maximum ratings are not exceeded. the ratings and conditions indicated for dc characteristics and ac characteristics represent the quality assurance range during normal operation.
chapter 17 electrical specifications (target values) 886 preliminary user?s manual u16031ej2v1ud capacitance (t a = 25 c, iv dd = iv ss = ev dd = ev ss = oscv dd = oscv ss = pllv dd = pllv ss = uv dd = av dd = av ss = 0 v) parameter symbol conditions min. typ. max. unit input capacitance c i 15 pf i/o capacitance c io 15 pf output capacitance c o f c = 1 mhz unmeasured pins returned to 0 v 15 pf operating conditions part number internal operation clock frequency (f x ) operating ambient temperature (t a ) supply voltage (v dd ) when external pin load capacitance c l = 50 pf, ? 40 to +70 c pd7030111gm-10-ueu 10 to100 mhz when external pin load capacitance c l = 30 pf, ? 40 to +85 c when external pin load capacitance c l = 50 pf, ? 40 to +70 c pd7030111gm-13-ueu 10 to133 mhz when external pin load capacitance c l = 30 pf, ? 40 to +85 c iv dd = 1.5 v 0.15 v pllv dd = 1.5 v 0.15 v ev dd = 3.3 v 0.3 v oscv dd = 3.3 v 0.3 v uv dd = 3.3 v 0.3 v av dd = 3.3 v 0.3 v pd7030111gm-15-ueu 10 to150 mhz when external pin load capacitance c l = 50 pf, ? 40 to +70 c iv dd = 1.4 to1.65 v pllv dd = 1.4 to1.65 v ev dd = 3.3 v 0.3 v oscv dd = 3.3 v 0.3 v uv dd = 3.3 v 0.3 v av dd = 3.3 v 0.3 v
chapter 17 electrical specifications (target values) 887 preliminary user?s manual u16031ej2v1ud recommended oscillator (a) ceramic resonator (i) murata mfg. co., ltd. (t a = ? ? ? ? 40 to +85 c) x1 x2 r d c2 c1 recommended circuit constant oscillation voltage range type part number oscillation frequency f x (mhz) c1 (pf) c2 (pf) r d (k ? ) min. (v) max. (v) oscillation stabilization time (max.) t ost (ms) cstce10m0g55-r0 10.000 on-chip on-chip 0 3.0 3.6 0.07 cstce12m5g55-r0 12.500 on-chip on-chip 0 3.0 3.6 0.08 cstce16m6v53-r0 16.625 on-chip on-chip 0 3.0 3.6 0.04 cstce18m0v53-r0 18.000 on-chip on-chip 0 3.0 3.6 0.03 surface mounting cstce18m7v53-r0 18.750 on-chip on-chip 0 3.0 3.6 0.03 cautions 1. connect the oscillator as close as possible to the x1 and x2 pins. 2. do not route the wiring near broken lines. 3. sufficiently evaluate the matching between the pd703111 and the resonator.
chapter 17 electrical specifications (target values) 888 preliminary user?s manual u16031ej2v1ud (ii) tdk (t a = ? ? ? ? 40 to +85 c) x1 x2 r d c2 c1 recommended circuit constant oscillation voltage range type part number oscillation frequency f x (mhz) c1 (pf) c2 (pf) r d (k ? ) min. (v) max. (v) oscillation stabilization time (max.) t ost (ms) lead fcr10.0mc5 10.0 on-chip on-chip 0 3.0 3.6 0.076 surface mounting ccr18.0mxc7 18.0 on-chip on-chip 0 3.0 3.6 0.9 cautions 1. connect the oscillator as close as possible to the x1 and x2 pins. 2. do not route the wiring near broken lines. 3. sufficiently evaluate the matching between the pd703111 and the resonator.
chapter 17 electrical specifications (target values) 889 preliminary user?s manual u16031ej2v1ud dc characteristics (t a = ? ? ? ? 40 to +85 c, ev dd = 3.3 v 0.3 v, ev ss = 0 v) parameter symbol conditions min. typ. max. unit except for notes 1, 2 2.0 ev dd + 0.3 v note 1 0.75ev dd ev dd + 0.3 v input voltage, high v ih note 2 2.0 uv dd + 0.3 v except for notes 1, 2 ? 0.5 0.8 v note 1 ? 0.5 0.2ev dd v input voltage, low v il note 2 ? 0.5 0.8 v v t + note 1 , rising edge 1.9 v schmitt-triggered input threshold voltage v t ? note 1 , falling edge 1.3 v schmitt-triggered input hysteresis width v t + ? v t ? note 1 0.3 0.6 v i oh = ? 2.5 ma 0.8ev dd v except for note 2 i oh = ? 100 aev dd ? 0.4 v output voltage, high v oh note 2 , r l = 15 k ? (ev ss connection) 2.8 v except for note 2, i ol = 2.5 ma 0.45 v output voltage, low v ol note 2 , r l = 15 k ? (uv dd connection) 0.3 v input leakage current, high i lih v i = ev dd , except for note 3 10 a input leakage current, low i lil v i = 0 v, except for note 3 ? 10 a output leakage current, high i loh v o = ev dd 10 a output leakage current, low i lol v o = 0 v ? 10 a analog pin input leakage current i lwasn note 3 10 a iv dd + pllv dd pins 0.82 f x + 10 0.90 f x + 117 ma normal i dd1 ev dd pin note 4 0.33 f bus + 3.2 0.66 f bus + 6.4 note 5 ma iv dd + pllv dd pins 0.82 f x + 4 0.85 f x + 114 ma halt i dd2 ev dd pin note 4 0.33 f bus + 3.2 0.66 f bus + 6.4 note 5 ma iv dd +pllv dd pins 0.015 f x + 10 ma idle i dd3 ev dd pin note 4 500 a iv dd +pllv dd pins 4 ma supply current stop i dd4 ev dd pin note 4 500 a notes 1 . p11/sck0/intp11, p12/rxd0/si0, p20/nmi, p21/rxd1/intp21, p23/sck1/intp23, p24/si1/intp24, pcm1, reset 2. udm, udp 3. ani0 to ani7 4. current value with no load 5. calculate the current value with a load using the following expression. current value per pin ( a) = 3.63 c l f c l : load capacitance (pf) f: pin average operating frequency remarks 1. typ. values are reference values for when t a = 25 c, ev dd = 3.3 v. the current that flows through pull-up resistors is not included. 2. f x : main clock frequency (mhz) f bus: usclk frequency (mhz)
chapter 17 electrical specifications (target values) 890 preliminary user ? s manual u16031ej2v1ud ac characteristics (t a = ? ? ? ? 40 to +85 c, iv dd = pllv dd = 1.5 v 0.15 v note , ev dd = oscv dd = 3.3 v 0.3 v, iv ss = ev ss = pllv ss = oscv ss = 0 v, output pin load capacitance: c l = 30 pf) (t a = ? ? ? ? 40 to +70 c, iv dd = pllv dd = 1.5 v 0.15 v note , ev dd = oscv dd = 3.3 v 0.3 v, iv ss = ev ss = pllv ss = oscv ss = 0 v, output pin load capacitance: c l = 50 pf) note consider the operation conditions when operating at 133.34 to150 mhz. ac test input measurement points (a) p11/sck0/intp11, p12/rxd0/si0, p20/nmi, p21/rxd1/intp21, p23/sck1/intp23, p24/si1/intp24, pcm1, reset 0.75ev dd 0.2ev dd 0.75ev dd 0.2ev dd measurement points input signal ev dd 0 v (b) other than (a) 2.0 v 0.8 v 2.0 v 0.8 v measurement points input signal ev dd 0 v ac test output measurement points 0.7ev dd 0.2ev dd 0.7ev dd 0.2ev dd measurement points output signal
chapter 17 electrical specifications (target values) 891 preliminary user ? s manual u16031ej2v1ud load conditions cor l = 50 pf c l = 30 pf dut (device under test) caution at ? ? ? ? 40 to +70 c: if the load capacitance exceeds 50 pf due to the circuit configuration, make the load capacitance of this device 50 pf or lower by inserting a buffer, etc. at ? ? ? ? 40 to +85 c: if the load capacitance exceeds 30 pf due to the circuit configuration, make the load capacitance of this device 30 pf or lower by inserting a buffer, etc.
chapter 17 electrical specifications (target values) 892 preliminary user ? s manual u16031ej2v1ud (1) clock timing parameter symbol conditions min. max. unit x1 input cycle <1> t cyx including resonator error 52.5 100 ns output load capacitance 30 pf, t a = ? 40 to +85 c 14.3 400 note ns busclk output cycle <2> t cyk 30 pf < output load capacitance 50 pf, t a = ? 40 to +70 c 19.0 400 note ns busclk high-level width <3> t wkh1 0.5t ? 2 0.5t + 2 ns busclk low-level width <4> t wkl1 0.5t ? 2 0.5t + 2 ns busclk rise time <5> t kr1 3ns busclk fall time <6> t kf1 3ns note the output cycle after sscg output is selected by the cks register. remark t = t cyk x1 <1> busclk (output) <5> <6> <3> <4> <2>
chapter 17 electrical specifications (target values) 893 preliminary user?s manual u16031ej2v1ud (2) output waveform (other than x1, busclk) parameter symbol conditions min. max. unit other than note 6ns output rise time <7> t or note 8ns other than note 6ns output fall time <8> t of note 8ns note p10/uclk/intp10, p12/rxd0/si0, p20/nmi, p21/rxd1/intp21, p22/txd1/intp22, p24/si1/intp24, p50/dmarq0/intp50, p51/dmaak0/intp51, p52/tc0/intp52, p53/dmarq1/tic0/intpc00, p54/dmaak1/intpc01, p55/tc1/toc0, p65/intpc10/tic1/intp65, p66/intpc11/intp66, p67/toc1/intp67, p72/dmarq2/intpc20/tic2, p73/dmaak2/intpc21, p74/tc2/toc2, p75/dmarq3/intpc30/tic3, p76/dmaak3/intpc31, p77/tc3/toc3 <8> <7> signal other than x1, busclk (3) reset timing parameter symbol conditions min. max. unit reset pin high-level width <9> t wrsh 500 ns including oscillation stabilization time at power on and stop mode release. however, when the oscillation stabilization time exceeds 100 s, secure the necessary oscillation stabilization time. 100 s reset pin low-level width <10> t wrsl excluding at power on and stop mode release. 100 s caution sufficiently evaluate the oscillation stabilization time. <9> <10> reset (input)
chapter 17 electrical specifications (target values) 894 preliminary user ? s manual u16031ej2v1ud (4) sram, external rom, external i/o access timing (a) access timing (sram, external rom, external i/o) (1/2) parameter symbol conditions min. max. unit address, csn output delay time (from busclk ) <11> t dka 211ns address, csn output hold time (from busclk ) <12> t hka 211ns rd, iord delay time (from busclk ) <13> t dkrdl 111ns rd, iord delay time (from busclk ) <14> t hkrdh 211ns xxwr, iowr, wr delay time (from busclk ) <15> t dkwrl 211ns xxwr, iowr, wr delay time (from busclk ) <16> t hkwrh 111ns bcyst delay time (from busclk ) <17> t dkbsl 211ns bcyst delay time (from busclk ) <18> t hkbsh 211ns wait setup time (to busclk ) <19> t swk 6ns wait hold time (from busclk ) <20> t hkw 2ns data input setup time (to busclk ) <21> t skid 6ns data input hold time (from busclk ) <22> t hkid 2ns data output delay time (from busclk ) <23> t dkod1 211ns data float delay time (from busclk ) <24> t hkod 211ns remarks 1. observe at least one of the data input hold times t hrdid and t hkid . 2. n = 0 to 7 xx = uu, ul, lu, ll
chapter 17 electrical specifications (target values) 895 preliminary user ? s manual u16031ej2v1ud (a) access timing (sram, external rom, external i/o) (2/2) busclk (output) bcyst (output) [read] [write] [read] iord, rd (output) t1 tw t2 csn (output) <11> <12> <17> <13> <15> <16> <14> <22> <21> <24> <19> <20> <19> <20> a0 to a25 (output) wait (input) d0 to d31 (i/o) d0 to d31 (i/o) <18> <16> <24> <14> <17> <13> <15> <23> note [write] uuwr, ulwr (output) luwr, llwr (output) iowr, wr (output) note when a write cycle is executed without inserting a t0 state immediately after a read cycle, the data output timing is delayed by a half clock (in synchronization with the falling edge of busclk). remarks 1. timing when the number of waits set by the dwc0 and dwc1 registers is 0. 2. broken lines indicate high impedance. 3. n = 0 to 7
chapter 17 electrical specifications (target values) 896 preliminary user ? s manual u16031ej2v1ud (b) read timing (sram, external rom, external i/o) (1/2) parameter symbol conditions min. max. unit data input setup time (to address) <25> t said (2 + w + w d + w as ) t ? 17 ns data input setup time (to rd) <26> t srdid (1.5 + w + w d ) t ? 17 ns rd, iord low-level width <27> t wrdl (1.5 + w +w d ) t ? 6ns rd, iord high-level width <28> t wrdh (0.5 + w as +i) t ? 6ns delay time from address, csn to rd, iord <29> t dard (0.5 + w as ) t ? 7.5 ns delay time from rd, iord to address <30> t drda it ? 2ns data input hold time (from rd, iord ) <31> t hrdid 0ns delay time from rd, iord to data output <32> t drdod (0.5 + i) t ? 6ns wait setup time (to address) <33> t saw note 1 (1 + w as ) t ? 17 ns wait setup time (to bcyst ) <34> t sbsw note 1 (1 + w as ) t ? 17 ns wait hold time (from bcyst ) <35> t hbsw note 1 (w as + w d ) t + 2 ns wait high-level width <36> t wwh note 2 t + 2 ns data output hold time (from xxwr, iowr, wr ) <37> t hwrod (0.5 + i) t ? 5.5 ns notes 1. at the first wait sampling 2. time necessary for releasing the wait state remarks 1. t = t cyk 2. w: number of waits inserted due to wait 3. w d : number of waits inserted by dwc0 and dwc1 registers 4. observe at least one of the data input hold times t hrdid and t hkid . 5. n = 0 to 7 xx = uu, ul, lu, ll 6. i: number of idle states 7. w as : number of address setup waits inserted by asc register
chapter 17 electrical specifications (target values) 897 preliminary user?s manual u16031ej2v1ud (b) read timing (sram, external rom, external i/o) (2/2) busclk (output) csn (output) a0 to a25 (output) rd, iord (output) d0 to d31 (i/o) t1 tw t2 <31> <28> <27> <30> note <32> <25> <26> <29> <33> <34> ti tasw <35> <37> <36> wait (input) bcyst (output) uuwr, ulwr (output) luwr, llwr (output) iowr, wr (output) uube,ulbe (output) lube, llbe (output) note in the case of the csn signal remarks 1. timing when the number of waits inserted by the dwc0 or dwc1 register is 0, the number of idle states inserted by the bcc register is 1, and the number of waits inserted by the asc register is 1. 2. broken lines indicate high impedance.  3. n = 0 to 7
chapter 17 electrical specifications (target values) 898 preliminary user?s manual u16031ej2v1ud (c) write timing (sram, external rom, external i/o) (1/2) parameter symbol conditions min. max. unit wait setup time (to address) <33> t saw note 1 (1 +w as ) t ? 17 ns wait setup time (to bcyst ) <34> t sbsw note 1 (1 +w as ) t ? 17 ns wait hold time (from bcyst ) <35> t hbsw note 1 (w as +w d ) t +2 ns wait high-level width <36> t wwh note 2 t + 2 ns delay time from address, csn to xxwr, iowr, wr <38> t dawr (0.5 +w as ) t ? 7ns address setup time (to xxwr, iowr, wr ) <39> t sawr (1.5 + w + w d + w as ) t ? 10 ns delay time from xxwr, iowr, wr to address <40> t dwra (0.5 + i) t ? 5ns xxwr, iowr, wr high-level width <41> t wwrh (0.5 + i +w as ) t ? 5ns xxwr, iowr, wr low-level width <42> t wwrl (1 +w + w d ) t ? 5ns data output setup time (to xxwr, iowr, wr ) <43> t sodwr (1.5 + w as + w + w d ) t ? 5ns data output hold time (from xxwr, iowr, wr ) <37> t hwrod (0.5 + i) t ? 5.5 ns notes 1. at the first wait sampling 2. time necessary for releasing the wait state remarks 1. t = t cyk 2. w: number of waits inserted due to wait 3. w d : number of waits inserted by dwc0 and dwc1 registers 4. n = 0 to 7 xx = uu, ul, lu, ll 5. i: number of idle states 6. w as : number of address setup waits inserted by asc register
chapter 17 electrical specifications (target values) 899 preliminary user ? s manual u16031ej2v1ud (c) write timing (sram, external rom, external i/o) (2/2) <41> <39> <40> note <38> <42> <43> uuwr, ulwr (output) luwr, llwr (output) iowr, wr (output) <37> busclk (output) t1 tw t2 ti tasw <33> <34> wait (input) bcyst (output) <35> <36> d0 to d31 (i/o) csn (output) a0 to a25 (output) uube, ulbe (output) lube, llbe (output) note in the case of the csn signal remarks 1. timing when the number of waits inserted by the dwc0 or dwc1 register is 0, the number of idle states inserted by the bcc register is 1, and the number of waits inserted by the asc register is 1. 2. broken lines indicate high impedance. 3. n = 0 to 7
chapter 17 electrical specifications (target values) 900 preliminary user?s manual u16031ej2v1ud (d) dma flyby transfer timing (transfer from sram to external i/o) (1/2) parameter symbol conditions min. max. unit wait setup time (to busclk ) <19> t swk 6ns wait hold time (from busclk ) <20> t hkw 2ns rd low-level width <27> t wrdl (1.5 + w +w fw ) t ? 6ns rd high-level width <28> t wrdh (0.5 + w as +i) t ? 6ns delay time from address, csn to rd <29> t dard (0.5 + w as ) t ? 7.5 ns delay time from rd to address <30> t drda it ? 2ns delay time from rd to data output <32> t drdod (0.5 + i) t ? 6ns wait setup time (to address) <33> t saw note (1 +w as ) t ? 17 ns wait setup time (to bcyst ) <34> t sbsw note (1 +w as ) t ? 17 ns wait hold time (from bcyst ) <35> t hbsw note (w as + w fw ) t + 2 ns wait high-level width <36> t wwh t + 2 ns delay time from address to iowr <38> t dawr (0.5 + w as ) t ? 7ns address setup time (to iowr ) <39> t sawr (1.5 +w + w fw +w as ) t ? 10 ns delay time from iowr to address <40> t dwra (1.5 +i) t ? 5ns iowr high-level width <41> t wwrh (0.5 + i + w as ) t ? 5ns iowr low-level width <42> t wwrl (1 + w + w fw ) t ? 5ns delay time from iowr to rd <44> t diwrrd 1.5t ? 10 ns delay time from dmaakm to iowr <45> t ddawr (0.5 + w as ) t ? 7.5 ns delay time from iowr to dmaakm <46> t dwrda (1.5 +i) t ? 10 ns note at the first wait sampling remarks 1. t = t cyk 2. w: number of waits inserted due to wait 3. w fw : number of waits inserted by fwc register 4. n = 0 to 7, m = 0 to 3 5. i: number of idle states 6. w as : number of address setup waits inserted by asc register
chapter 17 electrical specifications (target values) 901 preliminary user?s manual u16031ej2v1ud (d) dma flyby transfer timing (transfer from sram to external i/o) (2/2) <28> <27> <41> <38> <39> <29> <45> <42> <19> <20> <19> <20> <33> dmaakm (output) iord (output) iowr (output) rd (output) wait (input) bcyst (output) <34> csn (output) a0 to a25 (output) <35> busclk (output) t1 tw t2 tasw <30> note <46> <40> <32> ti tf <44> <36> d0 to d31 (i/o) uube, ulbe (output) lube, llbe (output) uuwr, ulwr (output) luwr, llwr (output) wr (output) note in the case of the csn signal remarks 1. timing when the number of waits inserted by the fwc register is 0, the number of idle states inserted by the fic register is 1, and the number of waits inserted by the asc register is 1. 2. broken lines indicate high impedance. 3. n = 0 to 7, m = 0 to 3
chapter 17 electrical specifications (target values) 902 preliminary user ? s manual u16031ej2v1ud (e) dma flyby transfer timing (transfer from external i/o to sram) (1/2) parameter symbol conditions min. max. unit wait setup time (to busclk ) <19> t swk 6ns wait hold time (from busclk ) <20> t hkw 2ns iord low-level width <27> t wrdl (2 +w +w fw ) t ? 6ns iord high-level width <28> t wrdh (1 +w as +i) t ? 6ns delay time from address, csn to iord <29> t dard (0.5 +w as ) t ? 7.5 ns delay time from iord to address <30> t drda it ? 2ns delay time from iord to data output <32> t drdod (0.5 +i) t ? 6ns wait setup time (to address) <33> t saw note (1 +w as ) t ? 17 ns wait setup time (to bcyst ) <34> t sbsw note (1 +w as ) t ? 17 ns wait hold time (from bcyst ) <35> t hbsw note (w as +w fw ) t + 2 ns wait high-level width <36> t wwh t + 2 ns delay time from address to xxwr, wr <38> t dawr (0.5 +w as ) t ? 7ns address setup time (to xxwr, wr ) <39> t sawr (1.5 +w +w fw +w as ) t ? 10 ns delay time from xxwr, wr to address <40> t dwra (0.5 +i) t ? 5ns xxwr, wr high-level width <41> t wwrh (0.5 +i +w as ) t ? 5ns xxwr, wr low-level width <42> t wwrl (1 +w +w fw ) t ? 5ns delay time from xxwr, wr to iord <47> t dwrird t ? 10 ns delay time from dmaakm to iord <48> t ddard (0.5 +w as ) t ? 7.5 ns delay time from iord to dmaakm <49> t drdda (0.5 +i) t ? 7.5 ns note at the first wait sampling remarks 1. t = t cyk 2. w: number of waits inserted due to wait 3. w fw : number of waits inserted by fwc register 4. n = 0 to 7, m = 0 to 3 xx = uu, ul, lu, ll 5. i: number of idle states inserted when a write cycle is inserted after a read cycle 6. w as : number of address setup waits inserted by asc register
chapter 17 electrical specifications (target values) 903 preliminary user ? s manual u16031ej2v1ud (e) dma flyby transfer timing (transfer from external i/o to sram) (2/2) <41> <42> <40> note <28> <49> <30> <27> <32> d0 to d31 (i/o) <38> <39> <48> <29> rd (output) dmaakm (output) iowr (output) iord (output) <19> <20> <19> <20> <33> wait (input) bcyst (output) <34> <35> busclk (output) t1 tw t2 ti tasw tf <47> <36> csn (output) a0 to a25 (output) uube, ulbe (output) lube, llbe (output) uuwr, ulwr (output) luwr, llwr (output) wr (output) note in the case of the csn signal remarks 1. timing when the number of waits inserted by the fwc register is 0, the number of idle states inserted by the fic register is 1, and the number of waits inserted by the asc register is 1. 2. broken lines indicate high impedance. 3. n = 0 to 7, m = 0 to 3
chapter 17 electrical specifications (target values) 904 preliminary user ? s manual u16031ej2v1ud (5) page rom access timing (1/2) parameter symbol conditions min. max. unit wait setup time (to busclk ) <19> t swk 6ns wait hold time (from busclk ) <20> t hkw 2ns data input setup time (to busclk ) <21> t skid 6ns data input hold time (from busclk ) <22> t hkid 2ns off-page data input setup time (to address) <25> t said (2 +w +w d +w as ) t ? 17 ns off-page data input setup time (to rd) <26> t srdid (1.5 +w +w d ) t ? 17 ns data input hold time (from rd ) <31> t hrdid 2ns delay time from rd to data output <32> t drdod (0.5 +i) t ? 6ns on-page data input setup time (to address) <50> t soaid (2 +w +w pr ) t ? 17 ns remarks 1. t = t cyk 2. w: number of waits inserted due to wait 3. w d : number of waits inserted by dwc0 and dwc1 registers 4. w pr : number of waits inserted by prc register 5. i: number of idle states inserted when a write cycle is inserted after a read cycle 6. w as : number of address setup waits inserted by asc register 7. observe at least one of the data input hold times t hrdid and t hkid .
chapter 17 electrical specifications (target values) 905 preliminary user ? s manual u16031ej2v1ud (5) page rom access timing (2/2) csn (output) busclk (output) t1 tdw tw t2 <25> <26> <22> <20> <19> <19> <20> d0 to d31 (i/o) rd (output) wait (input) <21> to1 tprw tw to2 <50> <21> <22> <31> <20> <19> <20> <19> tasw <32> address note (output) uuwr, ulwr (output) luwr, llwr (output) wr (output) note on-page addresses and off-page addresses are shown below. prc register ma6 ma5 ma4 ma3 on-page address off-page address 0 0 0 0 a0 to a2 a3 to a25 0 0 0 1 a0 to a3 a4 to a25 0 0 1 1 a0 to a4 a5 to a25 0 1 1 1 a0 to a5 a6 to a25 1 1 1 1 a0 to a6 a7 to a25 remarks 1. timing in the following case. number of waits inserted by dwc0 or dwc1 register (tdw): 1 number of waits inserted by prc register (tprw): 1 number of waits inserted by asc register (tasw): 1 2. broken lines indicate high impedance. 3. n = 0 to 7
chapter 17 electrical specifications (target values) 906 preliminary user?s manual u16031ej2v1ud (6) sdram access timing (a) read timing (sdram access) (1/2) parameter symbol conditions min. max. unit address delay time (from busclk ) <11> t dka 211ns bcyst delay time (from busclk ) <51> t dkbc 211ns csn delay time (from busclk ) <52> t dkcs 211ns sdras delay time (from busclk ) <53> t dkras 211ns sdcas delay time (from busclk ) <54> t dkcas 211ns xxdqm delay time (from busclk ) <55> t dkdqm 211ns sdcke delay time (from busclk ) <56> t dkcke 211ns data input setup time (sdram read, from busclk ) <57> t sdrmk 6ns data input hold time (sdram read, from busclk ) <58> t hkdrm 2ns delay time from busclk to data output <59> t dsdod (0.5 +i) t ns caution if an sram (external i/o) cycle that uses the xxwr signal is generated immediately after a read cycle to sdram, an sram (external i/o) writing error may occur. in this case, set the bcc register to insert an idle state in the sdram space or execute a countermeasure using external circuits. however, no writing error occurs in a synchronization design in which the xxwr signal is sampled using busclk. remarks 1. t = t cyk 2. i: number of idle states 3. n = 1, 3, 4, 6 xx = uu, ul, lu, ll
chapter 17 electrical specifications (target values) 907 preliminary user ? s manual u16031ej2v1ud (a) read timing (sdram access) (2/2) sdclk (output) tw tact tbcw tread tlate tlate <11> sdram: csn (output) d0 to d31 (i/o) sdcke (output) a12 (output) a2 to a11 (output) <11> <11> <11> <51> <52> <11> <11> <11> <11> <11> <53> <54> <55> <57> <58> <51> <52> <53> <54> <55> <11> bcyst (output) sdras (output) sdcas (output) we (output) data address bank address (output) <59> bank address, a2 to a11, address other than a12 (output) address bank address address row address address row address colum address <56> <56> uudqm, uldqm (output) ludqm, lldqm (output) remarks 1. number of waits inserted by bcw1n and bcw0n bits of the scrn register (tbcw): 2 2. broken lines indicate high impedance. 3. n = 1, 3, 4, 6
chapter 17 electrical specifications (target values) 908 preliminary user?s manual u16031ej2v1ud (b) write timing (sdram access) (1/2) parameter symbol conditions min. max. unit address delay time (from busclk ) <11> t dka 211ns bcyst delay time (from busclk ) <51> t dkbc 211ns csn delay time (from busclk ) <52> t dkcs 211ns sdras delay time (from busclk ) <53> t dkras 211ns sdcas delay time (from busclk ) <54> t dkcas 211ns xxdqm delay time (from busclk ) <55> t dkdqm 211ns sdcke delay time (from busclk ) <56> t dkcke 211ns we delay time (from busclk ) <60> t dkwe 211ns data output delay time (from busclk ) <61> t dkdt 211ns data float delay time (from busclk ) <62> t hzkdt 211ns caution if an sram (external i/o) cycle that uses the xxwr signal is generated immediately after a read cycle to sdram, an sram (external i/o) writing error may occur. in this case, execute a countermeasure using external circuits. however, no writing error occurs in a synchronization design in which the xxwr signal is sampled using busclk. remark n = 1, 3, 4, 6 xx = uu, ul, lu, ll
chapter 17 electrical specifications (target values) 909 preliminary user?s manual u16031ej2v1ud (b) write timing (sdram access) (2/2) busclk (output) bank address, a2 to a11, address other than a12 (output) t0 tact tbcw twr <11> d0 to d31 (i/o) sdcke (output) a12 (output) a2 to a11 (output) <11> <11> <11> <51> <52> <11> <11> <11> <11> <11> <53> <54> <60> <55> <61> <62> <51> <52> <53> <54> <60> <55> <11> bcyst (output) sdcas (output) we (output) sdras (output) sdram: csn (output) data address bank address (output) address bank address address row address address row address column address <56> <56> uudqm, uldqm (output) ludqm, lldqm (output) remarks 1. number of waits inserted by bcw1n and bcw0n bits of scrn register (tbcw): 2 2. broken lines indicate high impedance. 3. n = 1, 3, 4, 6
chapter 17 electrical specifications (target values) 910 preliminary user ? s manual u16031ej2v1ud (7) dmac timing (a) level mode (1/3) parameter symbol conditions min. max. unit dmarqn setup time (to busclk ) <63> t sdrk 2-cycle/flyby transfer 8 ns 4t cpu ? 20 note 1 ns 2-cycle transfer 0 6t cpu ? 20 note 2 ns dmarqn hold time (from dmaakn ) <64> t hkdr flyby transfer 0 2t bus +2t cpu ? 20 ns 2-cycle transfer 0 nt cpu +13 note 3 ns dmaakn output delay time (from busclk ) <65> t dkda flyby transfer 0 13 ns 2-cycle transfer 0 nt cpu +13 note 3 ns dmaakn output hold time (from busclk ) <66> t hkda flyby transfer 0 13 ns notes 1. second dma transfer request disable timing in single transfer. the accesses is as follows. transfer source transfer destination speculative read function internal data ram external memory/ internal instruction ram provided/none external memory internal data ram provided/none however, when the speculative read function is not provided, the following conditions apply. ? busclk = internal system clock (f clk ) ? external memory access wait setting = 0 2. second dma transfer request disable timing in single transfer. the access is other than that shown in the table in note 1. 3. n is as follows. ckm1 ckm0 busclk division ratio with respect to internal system clock (f clk )n 00f clk /1 1 01f clk /2 2 10f clk /3 3 11f clk /4 4 remarks 1. n = 0 to 3 2. t bus = 1 busclk cycle 3. t cpu = 1 internal system clock cycle
chapter 17 electrical specifications (target values) 911 preliminary user ? s manual u16031ej2v1ud (a) level mode (2/3) parameter symbol conditions min. max. unit note 1 2t cpu ? 8 note 2 ns 2-cycle transfer note 3 6t cpu ? 8 note 2 ns dmaakn low-level width <67> t wdal flyby transfer 2t bus +w as +w fw +w ic ? 8ns tcn output delay time (from busclk ) <68> t dktc 2-cycle/flyby transfer 2 13 ns tcn output hold time (from busclk ) <69> t hktc 2-cycle/flyby transfer 2 13 ns notes 1. normal operation (dmaakn output width = memory controller output) 2. the access is as follows. transfer source transfer destination speculative read function internal data ram external memory/ internal instruction ram provided/none external memory internal data ram provided/none however, when the speculative read function is not provided, the following conditions apply. ? busclk = internal system clock (f clk ) ? external memory access wait setting = 0 3. when selecting a mode in which dmaakn output width = memory controller output + 4t cpu remarks 1. n = 0 to 3 2. t bus = 1 busclk cycle 3. t cpu = 1 internal system clock cycle 4. w as = number of address setup waits inserted by asc register w fw = number of data waits inserted by fwc register w ic = number of idle states inserted by fic register
chapter 17 electrical specifications (target values) 912 preliminary user?s manual u16031ej2v1ud (a) level mode (3/3) busclk (output) <64> <65> <66> <68> <63> dmaakn (output) dmarqn (input) tcn (output) <69> <67> remarks 1. the minimum dmaakn inactive time is as follows. transfer mode transfer source transfer destination inactive time external memory/ external i/o on-chip peripheral i/o external memory/ external i/o on-chip peripheral i/o/ internal instruction ram 4t cpu internal data ram internal data ram 5t cpu internal data ram external memory/ external i/o on-chip peripheral i/o/ internal instruction ram 9t cpu single transfer, single-step transfer external memory/ external i/o on-chip peripheral i/o internal data ram 9t cpu block transfer ?? t cpu 2. n = 0 to 3
chapter 17 electrical specifications (target values) 913 preliminary user ? s manual u16031ej2v1ud (b) mask mode (1/3) parameter symbol conditions min. max. unit dmarqn setup time (to busclk ) <63> t sdrk 2-cycle/flyby transfer 8 ns dmarqn hold time 1 (from dmaakn ) <70> t hkdr1 2-cycle/flyby transfer to dmaakn ns 2-cycle transfer 0 3t bus ? 8 note 1 ns dmarqn hold time 2 (from busclk ) note 2 (dmaakn = ? h ? sample) <71> t hkdr2 flyby transfer 0 4t bus ? 8 note 3 ns 2-cycle transfer 0 nt cpu +13 note 4 ns dmaakn output delay time (from busclk ) <65> t dkda flyby transfer 0 13 ns 2-cycle transfer 0 nt cpu +13 note 4 ns dmaakn output hold time (from busclk ) <66> t hkda flyby transfer 0 13 ns notes 1. the second transfer request disable timing in single transfer. to busclk : since the dmaakn is output asynchronously with busclk, in accordance with the dmaakn rising ? h ? sample prescription, if dmaakn = ? h ? is output at the timing in which it cannot be sampled at the busclk (setup time < 8 ns), +1t bus is added. 2. time to dmaakn high level from busclk after dmaakn rises 3. the second dma transfer request disable timing in single transfer. 4. n is as follows. ckm1 ckm0 busclk division ratio to internal system clock (f clk )n 00f clk /1 1 01f clk /2 2 10f clk /3 3 11f clk /4 4 remarks 1. n = 0 to 3 2. t bus = 1 busclk cycle 3. t cpu = 1 internal system clock cycle
chapter 17 electrical specifications (target values) 914 preliminary user ? s manual u16031ej2v1ud (b) mask mode (2/3) parameter symbol conditions min. max. unit note 1 2t cpu ? 8 note 2 ns 2-cycle transfer note 3 6t cpu ? 8 note 2 ns dmaakn low-level width <67> t wdal flyby transfer 2t bus +w as +w fw +w ic ? 8ns tcn output delay time (from busclk ) <68> t dktc 2-cycle/flyby transfer 2 13 ns tcn output hold time (from busclk ) <69> t hktc 2-cycle/flyby transfer 2 13 ns notes 1. normal operation (dmaakn output width = memory controller output) 2. the access is as follows. transfer source transfer destination speculative read function internal data ram external memory/ internal instruction ram provided/none external memory internal data ram provided/none however, when the speculative read function is not provided, the following conditions apply. ? busclk = internal system clock (f clk ) ? external memory access wait setting = 0 3. when selecting a mode in which dmaakn output width = memory controller output +4t cpu remarks 1. n = 0 to 3 2. t bus = 1 busclk cycle 3. t cpu = 1 internal system clock cycle 4. w as = number of address setup waits inserted by asc register w fw = number of data waits inserted by fwc register w ic = number of idle states inserted by fic register
chapter 17 electrical specifications (target values) 915 preliminary user ? s manual u16031ej2v1ud (b) masks mode (3/3) busclk (output) <70> <65> <68> <63> dmaakn (output) dmarqn (input) tcn (output) <69> <71> <66> <67> remarks 1. the minimum dmaakn inactive time is as follows. transfer mode transfer source transfer destination inactive time external memory/ external i/o on-chip peripheral i/o external memory/ external i/o on-chip peripheral i/o/ internal instruction ram 4t cpu internal data ram internal data ram 5t cpu internal data ram external memory/ external i/o on-chip peripheral i/o/ internal instruction ram 9t cpu single transfer, single-step transfer external memory/ external i/o on-chip peripheral i/o internal data ram 9t cpu block transfer ?? t cpu 2. n = 0 to 3
chapter 17 electrical specifications (target values) 916 preliminary user?s manual u16031ej2v1ud (c) edge mode (1/3) parameter symbol conditions min. max. unit dmarqn hold time <64> t hkdr 2-cycle/flyby transfer 2t cpu ns dmarqn high-level time 1 (from dmarqn ) <72> t wdrh1 2-cycle/flyby transfer 2t cpu ns dmarqn high-level time 2 (from dmaakn ) <73> t wdrh2 2-cycle/flyby transfer 0 ns 2-cycle transfer 0 nt cpu +13 note ns dmaakn output delay time (from busclk ) <65> t dkda flyby transfer 0 13 ns 2-cycle transfer 0 nt cpu +13 note ns dmaakn output hold time (from busclk ) <66> t hkda flyby transfer 0 13 ns note n is as follows. ckm1 ckm0 busclk ratio to internal system clock (f clk )n 00f clk /1 1 01f clk /2 2 10f clk /3 3 11f clk /4 4 remarks 1. n = 0 to 3 2. t cpu = 1 internal system clock cycle
chapter 17 electrical specifications (target values) 917 preliminary user?s manual u16031ej2v1ud (c) edge mode (2/3) parameter symbol conditions min. max. unit note 1 2t cpu ? 8 note 2 ns 2-cycle transfer note 3 6t cpu ? 8 note 2 ns dmaakn low-level width <67> t wdal flyby transfer 2t bus +w as +w fw +w ic ? 8ns tcn output delay time (from busclk ) <68> t dktc 2-cycle/flyby transfer 2 13 ns tcn output hold time (from busclk ) <69> t hktc 2-cycle/flyby transfer 2 13 ns notes 1. time to dmaakn high level from busclk after dmaakn rises 2. the access is as follows. transfer source transfer destination speculative read function internal data ram external memory/ internal instruction ram provided/none external memory internal data ram provided/none however, when the speculative read function is not provided, the following conditions apply. ? busclk = internal system clock (f clk ) ? external memory access wait setting = 0 3. normal operation (dmaakn output width = memory controller output ) remarks 1. n = 0 to 3 2. t bus = 1 busclk cycle 3. t cpu = 1 internal system clock cycle 4. w as = number of address setup waits inserted by asc register w fw = number of data waits inserted by fwc register w ic = number of idle states inserted by fic register
chapter 17 electrical specifications (target values) 918 preliminary user?s manual u16031ej2v1ud (c) edge mode (3/3) busclk (output) <64> <65> <66> <68> dmaakn (output) dmarqn (input) tcn (output) <69> <72> <67> <73> remarks 1. the minimum dmaakn inactive time is as follows. transfer mode transfer source transfer destination inactive time external memory/ external i/o on-chip peripheral i/o external memory/ external i/o on-chip peripheral i/o/ internal instruction ram 4t cpu internal data ram internal data ram 5t cpu internal data ram external memory/ external i/o on-chip peripheral i/o/ internal instruction ram 9t cpu single transfer, single-step transfer external memory/ external i/o on-chip peripheral i/o internal data ram 9t cpu block transfer ?? t cpu 2. n = 0 to 3
chapter 17 electrical specifications (target values) 919 preliminary user ? s manual u16031ej2v1ud (8) bus hold timing (1/2) parameter symbol conditions min. max. unit hldrq setup time (to busclk ) <74> t shrk 10 ns hldrq hold time (from busclk ) <75> t hkhr 2ns delay time from busclk to hldak <76> t dkha 211ns hldrq high-level width <77> t whqh t + 12 ns hldak low-level width <78> t whal t ? 11 ns delay time from hldak to bus float <79> t dkcf 0ns delay time from hldak to bus output <80> t dhac 011ns delay time from hldrq to hldak <81> t dhqha1 2t ns delay time from hldrq to hldak <82> t dhqha2 t 2t + 10 ns remark t = t cyk
chapter 17 electrical specifications (target values) 920 preliminary user ? s manual u16031ej2v1ud (8) bus hold timing (2/2) busclk (output) ti d0 to d31 (i/o) <74> th th th ti t0 <75> <75> <74> <81> <76> <78> <82> <77> <76> <79> <80> a0 to a25 (output) address data hldrq (input) hldak (output) csn (output) bcyst (output) iord, rd (output) iowr, we/wr (output) note (output) <74> wait (input) undefined sdras, sdcas (output) note uuwr/uube/uudqm, ulwr/ulbe/uldqm, luwr/lube/ludqm, llwr/llbe/lldqm remarks 1. broken lines indicate high impedance. 2. n = 0 to 7
chapter 17 electrical specifications (target values) 921 preliminary user?s manual u16031ej2v1ud (9) interrupt timing (1/2) parameter symbol conditions min. max. unit nmi high-level width <83> t wnih 500 ns nmi low-level width <84> t wnil 500 ns when noise elimination has been set (number of set elimination clocks +1)/(f x /4) +10 ns intpcm0, intpcm1 pin (m = 0 to 3) high-level width <85> t witch when clock-through has been set 1/(f x /4) 2 +10 ns when noise elimination has been set (number of set elimination clocks +1)/(f x /4) +10 ns intpcm0, intpcm1 pin (m = 0 to 3) low-level width <86> t witcl when clock-through has been set 1/(f x /4) 2 +10 ns noise elimination clock = f x /4 selected (number of set elimination clocks +1)/(f x /4) +10 ns when noise elimination has been set noise elimination clock = f x /32 selected (number of set elimination clocks +1)/(fx/32) +10 ns intpa pin high-level width <87> t wit1h when clock-through has been set note noise elimination clock = f x /4 selected 1/(f x /4) 2 +10 ns noise elimination clock = f x /4 selected (number of set elimination clocks +1)/(f x /4) +10 ns when noise elimination has been set noise elimination clock = f x /32 selected (number of set elimination clocks +1)/(f x /32) +10 ns intpa pin low-level width <88> t wit1l when clock-through has been set note noise elimination clock = f x /4 selected 1/(fx/4) 2 +10 ns intpb high-level width <89> t witph both edge and level detection 500 +1/(fx/4) +10 ns intpb low-level width <90> t witpl both edge and level detection 500 +1/(fx/4) +10 ns note when clock-through has been set, do not select a noise elimination clock of f x /32. remarks 1. the noise elimination clock and clock-through are set values of the ncwc0 to ncwc3, ncw10, and ncw11 registers. 2. f x : main clock 3. a = 100, 101, 110, 111 b = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, l1
chapter 17 electrical specifications (target values) 922 preliminary user?s manual u16031ej2v1ud (9) interrupt timing (2/2) <83> <84> nmi (input) <85> <86> intpcm0, intpcm1 (input) <87> <88> intpa (input) <89> <90> intpb (input) remark m = 0 to 3 a = 100, 101, 110, 111 b = 10, 11, 21 to 25, 50 to 52, 65 to 67, d0 to d15, l0, l1 (10) timer c timing parameter symbol conditions min. max. unit when noise elimination has been set (number of set elimination clocks +1) /(f x /4) +10 ns ticn high-level width <91> t wtch when clock-through has been set 1/(f x /4) 2 +10 ns when noise elimination has been set (number of set elimination clocks +1) /(f x /4) +10 ns ticn low-level width <92> t wtcl when clock-through has been set 1/(f x /4) 2 +10 ns remarks 1. n = 0 to 3 2. the noise elimination clock and clock-through are set values of the ncwc0 to ncwc3 registers. <91> <92> ticn (input)
chapter 17 electrical specifications (target values) 923 preliminary user ? s manual u16031ej2v1ud (11) timer enc1 timing parameter symbol conditions min. max. unit noise elimination clock = f x /4 selected (number of set elimination clocks +1)/(f x /4) +10 ns when noise elimination has been set noise elimination clock = f x /32 selected (number of set elimination clocks +1)/(fx/32) +10 ns tclr1n, tcud1n, tiud1n pin high-level width <93> t wtench when clock-through has been set note noise elimination clock = f x /4 selected 1/ (f x /4) 2 +10 ns noise elimination clock = f x /4 selected (number of set elimination clocks +1)/(f x /4) +10 ns when noise elimination has been set noise elimination clock = f x /32 selected (number of set elimination clocks +1)/(f x /32) +10 ns tclr1n, tcud1n, tiud1n pin low-level width <94> t wtencl when clock-through has been set note noise elimination clock = f x /4 selected 1/(fx/4) 2 +10 ns note when clock-through has been set, do not select a noise elimination clock of f x /32. remarks 1. n = 0, 1 2. the noise elimination clock and clock-through are the set values of the ncw10 and ncw11 registers. <93> <94> tclr1n (input) tcud1n (input) tiud1n (input)
chapter 17 electrical specifications (target values) 924 preliminary user ? s manual u16031ej2v1ud (12) csi30, csi31 timing (1/3) (a) master mode parameter symbol conditions min. max. unit sckn cycle <95> t cysk1 output 182 ns sckn high-level width <96> t wsk1h output 0.5t cysk1 ? 12 ns sckn low-level width <97> t wsk1l output 0.5t cysk1 ? 12 ns sin setup time (to sckn )12ns sin setup time (to sckn ) <98> t ssisk 12 ns sin hold time (from sckn )5ns sin hold time (from sckn ) <99> t hsksi 5ns son output delay time (from sckn )7ns son output delay time (from sckn ) <100> t dskso 7ns son output hold time (from sckn )0.5t cysk1 ? 5ns son output hold time (from sckn ) <101> t hskso 0.5t cysk1 ? 5ns remark n = 0, 1 (b) slave mode parameter symbol conditions min. max. unit sckn cycle <95> t cysk1 input 182 ns sckn high-level width <96> t wsk1h input 0.5t cysk1 ? 20 ns sckn low-level width <97> t wsk1l input 0.5t cysk1 ? 20 ns sin setup time (to sckn )30ns sin setup time (to sckn ) <98> t ssisk 30 ns sin hold time (from sckn ) 1.5t + 10 ns sin hold time (from sckn ) <99> t hsksi 1.5t + 10 ns son output delay time (from sckn )12ns son output delay time (from sckn ) <100> t dskso 12 ns son output hold time (from sckn )t wsk1h ns son output hold time (from sckn ) <101> t hskso t wsk1h ns remarks 1. n = 0, 1 2. t = f x /4
chapter 17 electrical specifications (target values) 925 preliminary user ? s manual u16031ej2v1ud (12) csi30, csi31 timing (2/3) (c) timing when ckpn and dapn bits of csic3n register = 00 <95> <97> <96> <98> <99> <100> <101> sin (input) son (output) sckn (i/o) input data output data remarks 1. broken lines indicate high impedance. 2. n = 0, 1 (d) timing when ckpn and dapn bits of csic3n register = 01 <98> <99> <101> sin (input) son (output) input data output data <95> <97> <96> sckn (i/o) <100> remarks 1. broken lines indicate high impedance. 2. n = 0, 1
chapter 17 electrical specifications (target values) 926 preliminary user ? s manual u16031ej2v1ud (12) csi30, csi31 timing (3/3) (e) timing when ckpn and dapn bits of csic3n register = 10 <95> <97> <96> <98> <99> <100> <101> sin (input) son (output) sckn (i/o) input data output data remarks 1. broken lines indicate high impedance. 2. n = 0, 1 (e) timing when ckpn and dapn bits of csic3n register = 11 <98> <99> <101> sin (input) son (output) input data output data <95> <97> <96> sckn (i/o) <100> remarks 1. broken lines indicate high impedance. 2. n = 0, 1
chapter 17 electrical specifications (target values) 927 preliminary user?s manual u16031ej2v1ud a/d converter characteristics (ev dd = av dd = av refp = 3.0 to 3.6 v, ev ss = av ss = av refp = 0 v) parameter symbol conditions min. typ. max. unit resolution ? 10 bit overall error note 1 ? 0.49 %fsr quantization error ? 1/2 lsb conversion time t conv 2.00 10 s sampling time t samp 3 conversion clock note 2 /16 ns zero-scale error note 1 ? 0.49 %fsr full-scale error note 1 ? 0.49 %fsr integral linearity error note 3 ? 4lsb differential linearity error note 3 ? 4lsb analog input voltage v wasn av refm av refp v av dd power supply current ai dd 10 ma notes 1. excluding quantization error ( 0.05%fsr). 2. the conversion clock indicates the number of clocks set by the adm1 register. 3. excluding quantization error ( 0.5lsb). remark lsb: least significant bit fsr: full scale range %fsr indicates the ratio to the full-scale value.
928 preliminar y user?s manual u16031ej2v1ud chapter 18 package drawing 144 176 133 45 88 132 89 s s n 176-pin plastic lqfp (fine pitch) (24x24) j t detail of lead end c d a b r k m i s p l u q g f note each lead centerline is located within 0.10 mm of its true position (t.p.) at maximum material condition. item millimeters a b d g 26.0 0.2 24.0 0.2 1.25 26.0 0.2 c 24.0 0.2 l 0.5 f 1.25 n p q s 0.08 1.4 0.1 0.05 1.5 0.1 t u 0.25 0.60 0.15 s176gm-50-ueu-1 m 0.17 + 0.03 ? 0.07 h 0.22 0.05 i j k 0.08 0.5 (t.p.) 1.0 0.2 r3 + 4 ? 3 m h
929 preliminar y user?s manual u16031ej2v1ud chapter 19 recommended soldering conditions the v850e/me2 should be soldered and mounted under the following recommended conditions. for soldering methods and conditions other than those recommended below, contact an nec electronics sales representative. for technical information, see the following website. semiconductor device mount manual (http://www.necel.com/pkg/en/mount/index.html) table 19-1. surface mounting type soldering conditions pd703111gm-10-ueu: 176-pin plastic lqfp (fine pitch) (24 24) pd703111gm-13-ueu: 176-pin plastic lqfp (fine pitch) (24 24) pd703111gm-15-ueu: 176-pin plastic lqfp (fine pitch) (24 24) soldering soldering conditions recommended method condition symbol infrared reflow package peak temperature: 250 c, time: 30 seconds max. (at 210 c or higher), count: three times or less exposure limit: 3days note (after that, prebake at 125 c for 20 hours) ir50-203-3 partial heating pin temperature: 350 c max., time: 3 seconds max. (per pin row) ? caution do not use different soldering methods together (except for partial heating).
preliminary user?s manual u16031ej2v1ud 930 appendix a register index (1/13) symbol name unit page adcr0 to adcr7 a/d conversion result registers 0 to 7 adc 742 adcr0h to adcr7h a/d conversion result registers 0h to 7h adc 742 adic interrupt control register 83 adc 332 adm0 a/d converter mode register 0 adc 737 adm1 a/d converter mode register 1 adc 738 adm2 a/d converter mode register 2 adc 740 adts adc trigger select register adc 741 asc address setup wait control register bcu 154 bcc bus cycle control register bcu 159 bcp bus cycle period control register bcu 155 bct0 bus cycle type configuration register 0 bcu 121 bct1 bus cycle type configuration register 1 bcu 121 bec endian configuration register bcu 124 bhc cache configuration register bcu 161 bmc bus mode control register bcu 150 cc100 capture/compare register 100 rpu 447 cc101 capture/compare register 101 rpu 448 cc10ic0 interrupt control register 53 intc 332 cc10ic1 interrupt control register 54 intc 332 cc110 capture/compare register 110 rpu 447 cc111 capture/compare register 111 rpu 448 cc11ic0 interrupt control register 59 intc 332 cc11ic1 interrupt control register 60 intc 332 ccc00 capture/compare register c00 rpu 406 ccc01 capture/compare register c01 rpu 406 ccc0ic0 interrupt control register 37 intc 332 ccc0ic1 interrupt control register 38 intc 332 ccc10 capture/compare register c10 rpu 406 ccc11 capture/compare register c11 rpu 406 ccc1ic0 interrupt control register 39 intc 332 ccc1ic1 interrupt control register 40 intc 332 ccc20 capture/compare register c20 rpu 406 ccc21 capture/compare register c21 rpu 406 ccc2ic0 interrupt control register 41 intc 332 ccc2ic1 interrupt control register 42 intc 332
appendix a register index preliminary user?s manual u16031ej2v1ud 931 (2/13) symbol name unit page ccc30 capture/compare register c30 rpu 406 ccc31 capture/compare register c31 rpu 406 ccc3ic0 interrupt control register 43 intc 332 ccc3ic1 interrupt control register 44 intc 332 ccc40 capture/compare register c40 rpu 406 ccc41 capture/compare register c41 rpu 406 ccc4ic0 interrupt control register 45 intc 332 ccc4ic1 interrupt control register 46 intc 332 ccc50 capture/compare register c50 rpu 406 ccc51 capture/compare register c51 rpu 406 ccc5ic0 interrupt control register 47 intc 332 ccc5ic1 interrupt control register 48 intc 332 ccr10 capture/compare control register 10 rpu 452 ccr11 capture/compare control register 11 rpu 452 ckc clock control register cg 366 cks clock source select register cg 369 cm100 compare register 100 rpu 446 cm101 compare register 101 rpu 446 cm10ic0 interrupt control register 55 intc 332 cm10ic1 interrupt control register 56 intc 332 cm110 compare register 110 rpu 446 cm111 compare register 111 rpu 446 cm11ic0 interrupt control register 61 intc 332 cm11ic1 interrupt control register 62 intc 332 cmd0 compare register d0 rpu 433 cmd1 compare register d1 rpu 433 cmd2 compare register d2 rpu 433 cmd3 compare register d3 rpu 433 cmdic0 interrupt control register 49 intc 332 cmdic1 interrupt control register 50 intc 332 cmdic2 interrupt control register 51 intc 332 cmdic3 interrupt control register 52 intc 332 covf3ic0 interrupt control register 70 intc 332 covf3ic1 interrupt control register 72 intc 332 csc0 chip area select control register 0 bcu 117 csc1 chip area select control register 1 bcu 117 csi3ic0 interrupt control register 69 intc 332 csi3ic1 interrupt control register 71 intc 332 csic30 clocked serial interface clock select register 30 csi30 538
appendix a register index preliminary user?s manual u16031ej2v1ud 932 (3/13) symbol name unit page csic31 clocked serial interface clock select register 31 csi31 538 csil30 transfer data length select register 30 csi30 546 csil31 transfer data length select register 31 csi31 546 csim30 clocked serial interface mode register 30 csi30 536 csim31 clocked serial interface mode register 31 csi31 536 dadc0 dma addressing control register 0 dmac 253 dadc1 dma addressing control register 1 dmac 253 dadc2 dma addressing control register 2 dmac 253 dadc3 dma addressing control register 3 dmac 253 dbc0 dma transfer count register 0 dmac 252 dbc1 dma transfer count register 1 dmac 252 dbc2 dma transfer count register 2 dmac 252 dbc3 dma transfer count register 3 dmac 252 dchc0 dma channel control register 0 dmac 256 dchc1 dma channel control register 1 dmac 256 dchc2 dma channel control register 2 dmac 256 dchc3 dma channel control register 3 dmac 256 dda0h dma destination address register 0h dmac 250 dda0l dma destination address register 0l dmac 251 dda1h dma destination address register 1h dmac 250 dda1l dma destination address register 1l dmac 251 dda2h dma destination address register 2h dmac 250 dda2l dma destination address register 2l dmac 251 dda3h dma destination address register 3h dmac 250 dda3l dma destination address register 3l dmac 251 difc dma interface control register dmac 266 dmaic0 interrupt control register 65 intc 332 dmaic1 interrupt control register 66 intc 332 dmaic2 interrupt control register 67 intc 332 dmaic3 interrupt control register 68 intc 332 dsa0h dma source address register 0h dmac 248 dsa0l dma source address register 0l dmac 249 dsa1h dma source address register 1h dmac 248 dsa1l dma source address register 1l dmac 249 dsa2h dma source address register 2h dmac 248 dsa2l dma source address register 2l dmac 249 dsa3h dma source address register 3h dmac 248 dsa3l dma source address register 3l dmac 249 dtfr0 dma trigger factor register 0 dmac 260
appendix a register index preliminary user?s manual u16031ej2v1ud 933 (4/13) symbol name unit page dtfr1 dma trigger factor register 1 dmac 260 dtfr2 dma trigger factor register 2 dmac 260 dtfr3 dma trigger factor register 3 dmac 260 dtoc dma terminal count output control register dmac 259 dwc0 data wait control register 0 bcu 152 dwc1 data wait control register 1 bcu 152 fic dma flyby transfer idle control register bcu 160 fwc dma flyby transfer wait control register bcu 156 icc instruction cache control register bcu 164 icch instruction cache control register h bcu 164 iccl instruction cache control register l bcu 164 icd instruction cache data configuration register bcu 165 imr0 interrupt mask register 0 intc 335 imr0h interrupt mask register 0h intc 335 imr0l interrupt mask register 0l intc 335 imr1 interrupt mask register 1 intc 335 imr1h interrupt mask register 1h intc 335 imr1l interrupt mask register 1l intc 335 imr2 interrupt mask register 2 intc 335 imr2h interrupt mask register 2h intc 335 imr2l interrupt mask register 2l intc 335 imr3 interrupt mask register 3 intc 335 imr3h interrupt mask register 3h intc 335 imr3l interrupt mask register 3l intc 335 imr4 interrupt mask register 4 intc 335 imr4h interrupt mask register 4h intc 335 imr4l interrupt mask register 4l intc 335 imr5 interrupt mask register 5 intc 335 imr5h interrupt mask register 5h intc 335 imr5l interrupt mask register 5l intc 335 intf1 external interrupt falling edge specification register 1 intc 339, 812 intf2 external interrupt falling edge specification register 2 intc 324, 341, 817 intf5 external interrupt falling edge specification register 5 intc 343, 822 intf6 external interrupt falling edge specification register 6 intc 345, 827 intfal external interrupt falling edge specification register al intc 347, 835 intfdh external interrupt falling edge specification register dh intc 348, 846 intfdhh external interrupt falling edge specification register dhh intc 348, 846 intfdhl external interrupt falling edge specification register dhl intc 348, 846
appendix a register index preliminary user?s manual u16031ej2v1ud 934 (5/13) symbol name unit page intr1 external interrupt rising edge specification register 1 intc 339, 812 intr2 external interrupt rising edge specification register 2 intc 324, 341, 817 intr5 external interrupt rising edge specification register 5 intc 343, 822 intr6 external interrupt rising edge specification register 6 intc 345, 827 intral external interrupt rising edge specification register al intc 347, 835 intrdh external interrupt rising edge specification register dh intc 348, 846 intrdhh external interrupt rising edge specification register dhh intc 348, 846 intrdhl external interrupt rising edge specification register dhl intc 348, 846 iramm internal instruction ram mode register bcu 168 ispr in-service priority register intc 338 lbc0 line buffer control register 0 bcu 146 lbc1 line buffer control register 1 bcu 146 lbs local bus sizing control register bcu 123 lockr lock register cpu 374 ncw10 noise elimination width setting register 10 rpu 458, 865 ncw11 noise elimination width setting register 11 rpu 458, 865 ncwc0 noise elimination width setting register c0 rpu 415, 864 ncwc1 noise elimination width setting register c1 rpu 415, 864 ncwc2 noise elimination width setting register c2 rpu 415, 864 ncwc3 noise elimination width setting register c3 rpu 415, 864 nrs nmi reset status register intc 337 osts oscillation stabilization time select register cg 375 ov1ic0 interrupt control register 57 intc 332 ov1ic1 interrupt control register 63 intc 332 ovcic0 interrupt control register 31 intc 332 ovcic1 interrupt control register 32 intc 332 ovcic2 interrupt control register 33 intc 332 ovcic3 interrupt control register 34 intc 332 ovcic4 interrupt control register 35 intc 332 ovcic5 interrupt control register 36 intc 332 p1 port 1 port 809 p1ic0 interrupt control register 0 intc 332 p1ic1 interrupt control register 1 intc 332 p2 port 2 port 814 p2ic1 interrupt control register 2 intc 332 p2ic2 interrupt control register 3 intc 332 p2ic3 interrupt control register 4 intc 332 p2ic4 interrupt control register 5 intc 332
appendix a register index preliminary user?s manual u16031ej2v1ud 935 (6/13) symbol name unit page p2ic5 interrupt control register 6 intc 332 p5 port 5 port 819 p5ic0 interrupt control register 7 intc 332 p5ic1 interrupt control register 8 intc 332 p5ic2 interrupt control register 9 intc 332 p6 port 6 port 824 p6ic5 interrupt control register 10 intc 332 p6ic6 interrupt control register 11 intc 332 p6ic7 interrupt control register 12 intc 332 p7 port 7 port 829 pa h po r t a h port 837 pa h h po r t a h h port 837 pa h l po r t a h l port 837 pa l po r t a l port 832 pa l h po r t a l h port 832 pa l l po r t a l l port 832 pcd port cd port 857 pcm port cm port 854 pcs port cs port 848 pct port ct port 851 pdh port dh port 839 pdhh port dhh port 839 pdhl port dhl port 839 pdic0 interrupt control register 13 intc 332 pdic1 interrupt control register 14 intc 332 pdic2 interrupt control register 15 intc 332 pdic3 interrupt control register 16 intc 332 pdic4 interrupt control register 17 intc 332 pdic5 interrupt control register 18 intc 332 pdic6 interrupt control register 19 intc 332 pdic7 interrupt control register 20 intc 332 pdic8 interrupt control register 21 intc 332 pdic9 interrupt control register 22 intc 332 pdic10 interrupt control register 23 intc 332 pdic11 interrupt control register 24 intc 332 pdic12 interrupt control register 25 intc 332 pdic13 interrupt control register 26 intc 332 pdic14 interrupt control register 27 intc 332 pdic15 interrupt control register 28 intc 332
appendix a register index preliminary user?s manual u16031ej2v1ud 936 (7/13) symbol name unit page pfc1 port 1 function control register port 811 pfc2 port 2 function control register port 816 pfc5 port 5 function control register port 821 pfc6 port 6 function control register port 826 pfc7 port 7 function control register port 831 pfcall port al function control register l port 834 pfccm port cm function control register port 856 pfccs port cs function control register port 850 pfcct port ct function control register port 853 pfcdh port dh function control register port 843 pfcdhh port dh function control register h port 843 pfcdhl port dh function control register l port 843 plic0 interrupt control register 29 intc 332 plic1 interrupt control register 30 intc 332 pm1 port 1 mode register port 810 pm2 port 2 mode register port 815 pm5 port 5 mode register port 820 pm6 port 6 mode register port 825 pm7 port 7 mode register port 830 pmah port ah mode register port 838 pmahh port ah mode register h port 838 pmahl port ah mode register l port 838 pmal port al mode register port 833 pmalh port al mode register h port 833 pmall port al mode register l port 833 pmc1 port 1 mode control register port 810 pmc2 port 2 mode control register port 815 pmc5 port 5 mode control register port 820 pmc6 port 6 mode control register port 825 pmc7 port 7 mode control register port 830 pmcah port ah mode control register port 838 pmcahh port ah mode control register h port 838 pmcahl port ah mode control register l port 838 pmcal port al mode control register port 833 pmcalh port al mode control register h port 833 pmcall port al mode control register l port 833 pmccd port cd mode control register port 858 pmccm port cm mode control register port 855 pmccs port cs mode control register port 849
appendix a register index preliminary user?s manual u16031ej2v1ud 937 (8/13) symbol name unit page pmcct port ct mode control register port 852 pmcd port cd mode register port 858 pmcdh port dh mode control register port 841 pmcdhh port dh mode control register h port 841 pmcdhl port dh mode control register l port 841 pmcm port cm mode register port 855 pmcs port cs mode register port 849 pmct port ct mode register port 852 pmdh port dh mode register port 841 pmdhh port dh mode register h port 841 pmdhl port dh mode register l port 841 prc page rom configuration register memc 199 prcmd command register cpu 383 prm10 prescaler mode register 10 rpu 455 prm11 prescaler mode register 11 rpu 455 psc power-save control register cpu 384 psmr power-save mode register cpu 383 pwm0 pwm modulo register 0 pwm 771 pwm1 pwm modulo register 1 pwm 771 pwmc0 pwm control register 0 pwm 769 pwmc1 pwm control register 1 pwm 769 pwmh0 pwm modulo register h0 pwm 771 pwmh1 pwm modulo register h1 pwm 771 pwml0 pwm modulo register l0 pwm 771 pwml1 pwm modulo register l1 pwm 771 rfs1 sdram refresh control register 1 memc 236 rfs3 sdram refresh control register 3 memc 236 rfs4 sdram refresh control register 4 memc 236 rfs6 sdram refresh control register 6 memc 236 rsumic interrupt control register 89 intc 332 scr1 sdram configuration register 1 memc 209 scr3 sdram configuration register 3 memc 209 scr4 sdram configuration register 4 memc 209 scr6 sdram configuration register 6 memc 209 sesa10 valid edge select register 10 intc 352, 453 sesa11 valid edge select register 11 intc 352, 453 sesc0 valid edge select register c0 intc 350, 413 sesc1 valid edge select register c1 intc 350, 413 sesc2 valid edge select register c2 intc 350, 413
appendix a register index preliminary user?s manual u16031ej2v1ud 938 (9/13) symbol name unit page sesc3 valid edge select register c3 intc 350, 413 sfa30 csibuf status register 30 csi30 543 sfa31 csibuf status register 31 csi31 543 sfdb30 transmit data csi buffer register 30 csi30 542 sfdb30h transmit data csi buffer register 30h csi30 542 sfdb30l transmit data csi buffer register 30l csi30 542 sfdb31 transmit data csi buffer register 31 csi31 542 sfdb31h transmit data csi buffer register 31h csi31 542 sfdb31l transmit data csi buffer register 31l csi31 542 sfn30 transfer data number specification register 30 csi30 547 sfn31 transfer data number specification register 31 csi31 547 sirb30 receive data buffer register 30 csi30 541 sirb30h receive data buffer register 30h csi31 541 sirb30l receive data buffer register 30l csi30 541 sirb31 receive data buffer register 31 csi31 541 sirb31h receive data buffer register 31h csi31 541 sirb31l receive data buffer register 31l csi31 541 sscgc sscg control register cg 371 status10 status register 10 rpu 457 status11 status register 11 rpu 457 tmc0 timer c0 rpu 404 tmc1 timer c1 rpu 404 tmc10 timer control register 10 rpu 450 tmc11 timer control register 11 rpu 450 tmc2 timer c2 rpu 404 tmc3 timer c3 rpu 404 tmc4 timer c4 rpu 404 tmc5 timer c5 rpu 404 tmcc00 timer mode control register c00 rpu 408 tmcc01 timer mode control register c01 rpu 410 tmcc10 timer mode control register c10 rpu 408 tmcc11 timer mode control register c11 rpu 410 tmcc20 timer mode control register c20 rpu 408 tmcc21 timer mode control register c21 rpu 410 tmcc30 timer mode control register c30 rpu 408 tmcc31 timer mode control register c31 rpu 410 tmcc40 timer mode control register c40 rpu 408 tmcc41 timer mode control register c41 rpu 410 tmcc50 timer mode control register c50 rpu 408
appendix a register index preliminary user?s manual u16031ej2v1ud 939 (10/13) symbol name unit page tmcc51 timer mode control register c51 rpu 410 tmcd0 timer mode control register d0 rpu 435 tmcd1 timer mode control register d1 rpu 435 tmcd2 timer mode control register d2 rpu 435 tmcd3 timer mode control register d3 rpu 435 tmd0 timer d0 rpu 432 tmd1 timer d1 rpu 432 tmd2 timer d2 rpu 432 tmd3 timer d3 rpu 432 tmenc10 timer enc10 rpu 444 tmenc11 timer enc11 rpu 444 tum10 timer unit mode register 10 rpu 449 tum11 timer unit mode register 11 rpu 449 ub0ctl0 uartb0 control register 0 uartb 482 ub0ctl2 uartb0 control register 2 uartb 487 ub0fic0 uartb0 fifo control register 0 uartb 491 ub0fic1 uartb0 fifo control register 1 uartb 493 ub0fic2 uartb0 fifo control register 2 uartb 494 ub0fic2h uartb0 fifo control register 2h uartb 494 ub0fic2l uartb0 fifo control register 2l uartb 494 ub0fis0 uartb0 fifo status register 0 uartb 497 ub0fis1 uartb0 fifo status register 1 uartb 498 ub0rx uartb0 receive data register uartb 489 ub0rxap uartb0 receive data register ap uartb 489 ub0str uartb0 status register uartb 485 ub0tx uartb0 transmit data register uartb 488 ub1ctl0 uartb1 control register 0 uartb 482 ub1ctl2 uartb1 control register 2 uartb 487 ub1fic0 uartb1 fifo control register 0 uartb 491 ub1fic1 uartb1 fifo control register 1 uartb 493 ub1fic2 uartb1 fifo control register 2 uartb 494 ub1fic2h uartb1 fifo control register 2h uartb 494 ub1fic2l uartb1 fifo control register 2l uartb 494 ub1fis0 uartb1 fifo status register 0 uartb 497 ub1fis1 uartb1 fifo status register 1 uartb 498 ub1rx uartb1 receive data register uartb 489 ub1rxap uartb1 receive data register ap uartb 489 ub1str uartb1 status register uartb 485 ub1tx uartb1 transmit data register uartb 488
appendix a register index preliminary user?s manual u16031ej2v1ud 940 (11/13) symbol name unit page uckc usb clock control register cg 373 ud1ic0 interrupt control register 58 intc 332 ud1ic1 interrupt control register 64 intc 332 uf0aas uf0 active alternative setting register usbf 631 uf0adrs uf0 address register usbf 672 uf0aifn uf0 active interface number register usbf 630 uf0ass uf0 alternative setting status register usbf 632 uf0bc usb function 0 buffer control register usbf 681 uf0bi1 uf0 bulk in 1 register usbf 652 uf0bi2 uf0 bulk in 2 register usbf 656 uf0bo1 uf0 bulk out 1 register usbf 645 uf0bo1l uf0 bulk out 1 length register usbf 648 uf0bo2 uf0 bulk out 2 register usbf 649 uf0bo2l uf0 bulk out 2 length register usbf 652 uf0cie0 to uf0cie255 uf0 configuration/interface/endpoint descriptor registers 0 to 255 usbf 678 uf0clr uf0 clr request register usbf 595 uf0cnf uf0 configuration register usbf 673 uf0cs usb function 0 dma channel select register usbf 680 uf0dd0 to uf0dd17 uf0 device descriptor registers 0 to 17 usbf 677 uf0dend uf0 data end register usbf 625 uf0dms0 uf0 dma status 0 register usbf 621 uf0dms1 uf0 dma status 1 register usbf 622 uf0dscl uf0 descriptor length register usbf 676 uf0dstl uf0 device status register l usbf 664 uf0e0l uf0 ep0 length register usbf 640 uf0e0n uf0 ep0nak register usbf 586 uf0e0na uf0 ep0nakall register usbf 588 uf0e0r uf0 ep0 read register usbf 639 uf0e0sl uf0 ep0 status register l usbf 665 uf0e0st uf0 ep0 setup register usbf 641 uf0e0w uf0 ep0 write register usbf 643 uf0e1im uf0 endpoint 1 interface mapping register usbf 633 uf0e1sl uf0 ep1 status register l usbf 666 uf0e2im uf0 endpoint 2 interface mapping register usbf 634 uf0e2sl uf0 ep2 status register l usbf 667 uf0e3im uf0 endpoint 3 interface mapping register usbf 635 uf0e3sl uf0 ep3 status register l usbf 668
appendix a register index preliminary user?s manual u16031ej2v1ud 941 (12/13) symbol name unit page uf0e4im uf0 endpoint 4 interface mapping register usbf 636 uf0e4sl uf0 ep4 status register l usbf 669 uf0e7im uf0 endpoint 7 interface mapping register usbf 637 uf0e7sl uf0 ep7 status register l usbf 670 uf0e8im uf0 endpoint 8 interface mapping register usbf 638 uf0e8sl uf0 ep8 status register l usbf 671 uf0en uf0 epnak register usbf 589 uf0enm uf0 epnak mask register usbf 593 uf0eps0 uf0 ep status 0 register usbf 597 uf0eps1 uf0 ep status 1 register usbf 599 uf0eps2 uf0 ep status 2 register usbf 600 uf0fic0 uf0 fifo clear 0 register usbf 623 uf0fic1 uf0 fifo clear 1 register usbf 624 uf0gpr uf0 gpr register usbf 627 uf0ic0 uf0 int clear 0 register usbf 614 uf0ic1 uf0 int clear 1 register usbf 615 uf0ic2 uf0 int clear 2 register usbf 616 uf0ic3 uf0 int clear 3 register usbf 617 uf0ic4 uf0 int clear 4 register usbf 618 uf0idr uf0 int & dmarq register usbf 619 uf0if0 uf0 interface 0 register usbf 674 uf0if1 uf0 interface 1 register usbf 675 uf0if2 uf0 interface 2 register usbf 675 uf0if3 uf0 interface 3 register usbf 675 uf0if4 uf0 interface 4 register usbf 675 uf0im0 uf0 int mask 0 register usbf 609 uf0im1 uf0 int mask 1 register usbf 610 uf0im2 uf0 int mask 2 register usbf 611 uf0im3 uf0 int mask 3 register usbf 612 uf0im4 uf0 int mask 4 register usbf 613 uf0int1 uf0 interrupt 1 register usbf 660 uf0int2 uf0 interrupt 2 register usbf 662 uf0is0 uf0 int status 0 register usbf 601 uf0is1 uf0 int status 1 register usbf 603 uf0is2 uf0 int status 2 register usbf 605 uf0is3 uf0 int status 3 register usbf 606 uf0is4 uf0 int status 4 register usbf 608 uf0modc uf0 mode control register usbf 628 uf0mods uf0 mode status register usbf 629
appendix a register index preliminary user?s manual u16031ej2v1ud 942 (13/13) symbol name unit page uf0sds uf0 sndsie register usbf 594 uf0set uf0 set request register usbf 596 uific0 interrupt control register 76 intc 332 uific1 interrupt control register 81 intc 332 ureic0 interrupt control register 73 intc 332 ureic1 interrupt control register 78 intc 332 uric0 interrupt control register 74 intc 332 uric1 interrupt control register 79 intc 332 us0bic interrupt control register 84 intc 332 us1bic interrupt control register 85 intc 332 us2bic interrupt control register 86 intc 332 usp2ic interrupt control register 87 intc 332 usp4ic interrupt control register 88 intc 332 utic0 interrupt control register 75 intc 332 utic1 interrupt control register 80 intc 332 utoic0 interrupt control register 77 intc 332 utoic1 interrupt control register 82 intc 332 vswc system wait control register bcu 111
preliminary user?s manual u16031ej2v1ud 943 appendix b instruction set list b.1 conventions (1) register symbols used to describe operands register symbol explanation reg1 general-purpose registers: used as source registers. reg2 general-purpose registers: used mainly as destination registers. also used as source register in some instructions. reg3 general-purpose registers: used mainly to store the remainders of division results and the higher order 32 bits of multiplication results. bit#3 3-bit data for specifying the bit number immx x bit immediate data dispx x bit displacement data regid system register number vector 5-bit data that specifies the trap vector (00h to 1fh) cccc 4-bit data that shows the conditions code sp stack pointer (sp) ep element pointer (r30) listx x item register list (2) register symbols used to describe opcodes register symbol explanation r 1-bit data of a code that specifies reg1 or regid r 1-bit data of the code that specifies reg2 w 1-bit data of the code that specifies reg3 d 1-bit displacement data i 1-bit immediate data (indicates the higher bits of immediate data) i 1-bit immediate data cccc 4-bit data that shows the condition codes cccc 4-bit data that shows the condition codes of bcond instruction bbb 3-bit data for specifying the bit number l 1-bit data that specifies a program register in the register list s 1-bit data that specifies a system register in the register list
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 944 (3) register symbols used in operations register symbol explanation input for gr [ ] general-purpose register sr [ ] system register zero-extend (n) expand n with zeros until word length. sign-extend (n) expand n with signs until word length. load-memory (a, b) read size b data from address a. store-memory (a, b, c) write data b into address a in size c. load-memory-bit (a, b) read bit b of address a. store-memory-bit (a, b, c) write c to bit b of address a. saturated (n) execute saturated processing of n (n is a 2?s complement). if, as a result of calculations, n 7fffffffh, let it be 7fffffffh. n 80000000h, let it be 80000000h. result reflects the results in a flag. byte byte (8 bits) halfword half word (16 bits) word word (32 bits) + addition ? subtraction ll bit concatenation multiplication division % remainder from division results and logical product or logical sum xor exclusive or not logical negation logically shift left by logical shift left logically shift right by logical shift right arithmetically shift right by arithmetic shift right (4) register symbols used in execution clock register symbol explanation i if executing another instruction immediately after executing the first instruction (issue). r if repeating execution of the same instruction immediately after executing the first instruction (repeat). l if using the results of instruction execution in the instruction immediately after the execution (latency).
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 945 (5) register symbols used in flag operations identifier explanation (blank) no change 0 clear to 0 x set or cleared in accordance with the results. r previously saved values are restored. (6) condition codes condition name (cond) condition code (cccc) condition formula explanation v 0 0 0 0 ov = 1 overflow nv 1 0 0 0 ov = 0 no overflow c/l 0 0 0 1 cy = 1 carry lower (less than) nc/nl 1 0 0 1 cy = 0 no carry not lower (greater than or equal) z/e 0 0 1 0 z = 1 zero equal nz/ne 1 0 1 0 z = 0 not zero not equal nh 0 0 1 1 (cy or z) = 1 not higher (less than or equal) h 1 0 1 1 (cy or z) = 0 higher (greater than) n 0 1 0 0 s = 1 negative p 1 1 0 0 s = 0 positive t 0 1 0 1 ? always (unconditional) sa 1 1 0 1 sat = 1 saturated lt 0 1 1 0 (s xor ov) = 1 less than signed ge 1 1 1 0 (s xor ov) = 0 greater than or equal signed le 0 1 1 1 ((s xor ov) or z) = 1 less than or equal signed gt 1 1 1 1 ((s xor ov) or z) = 0 greater than signed
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 946 b.2 instruction set (in alphabetical order) (1/6) execution clock flags mnemonic operand opcode operation irlcyovszsat reg1,reg2 rrrrr001110rrrrr gr[reg2] gr[reg2]+gr[reg1] 1 1 1 add imm5,reg2 rrrrr010010iiiii gr[reg2] gr[reg2]+sign-extend(imm5) 1 1 1 addi imm16,reg1,reg2 rrrrr110000rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+sign-extend(imm16) 1 1 1 and reg1,reg2 rrrrr001010rrrrr gr[reg2] gr[reg2]and gr[reg1] 1 1 1 0 andi imm16,reg1,reg2 rrrrr110110rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]and zero-extend(imm16) 1 1 1 0 0 when conditions are satisfied 3 note 2 3 note 2 3 note 2 bcond disp9 ddddd1011dddcccc note 1 if conditions are satisfied then pc pc+sign-extend(disp9) when conditions are not satisfied 11 1 bsh reg2,reg3 rrrrr11111100000 wwwww01101000010 gr[reg3] gr[reg2] (23 : 16) ll gr[reg2] (31 : 24) ll gr[reg2] (7 : 0) ll gr[reg2] (15 : 8) 111 0 bsw reg2,reg3 rrrrr11111100000 wwwww01101000000 gr[reg3] gr[reg2] (7 : 0) ll gr[reg2] (15 : 8) ll gr [reg2] (23 : 16) ll gr[reg2] (31 : 24) 111 0 callt imm6 0000001000iiiiii ctpc pc+2(return pc) ctpsw psw adr ctbp+zero-extend(imm6 logically shift left by 1) pc ctbp+zero-extend(load-memory(adr,halfword)) 555 bit#3, disp16[reg1] 10bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not(load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,0) 3 note 3 3 note 3 3 note 3 clr1 reg2,[reg1] rrrrr111111rrrrr 0000000011100100 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,0) 3 note 3 3 note 3 3 note 3 cccc,imm5,reg2,reg3 rrrrr111111iiiii wwwww011000cccc0 if conditions are satisfied then gr[reg3] sign-extended(imm5) else gr[reg3] gr[reg2] 111 cmov cccc,reg1,reg2,reg3 rrrrr111111rrrr wwwww011001cccc0 if conditions are satisfied then gr[reg3] gr[reg1] else gr[reg3] gr[reg2] 111 reg1,reg2 rrrrr001111rrrrr result gr[reg2]?gr[reg1] 1 1 1 cmp imm5,reg2 rrrrr010011iiiii result gr[reg2]?sign-extend(imm5) 1 1 1 ctret 0000011111100000 0000000101000100 pc ctpc psw ctpsw 444rrrrr dbret 0000011111100000 0000000101000110 pc dbpc psw dbpsw 444rrrrr
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 947 (2/6) execution clock flags mnemonic operand opcode operation irlcyovszsat dbtrap 1111100001000000 dbpc pc+2 (returned pc) dbpsw psw psw.np 1 psw.ep 1 psw.id 1 pc 00000060h 444 di 0000011111100000 0000000101100000 psw.id 1111 imm5,list12 0000011001iiiiil lllllllllll00000 sp sp+zero-extend(imm5 logically shift left by 2) gr[reg in list12] load-memory(sp,word) sp sp+4 repeat 2 steps above until all regs in list12 is loaded n+1 note 4 n+1 note 4 n+1 note 4 dispose imm5,list12,[reg1] 0000011001iiiiil lllllllllllrrrrr note 5 sp sp+zero-extend(imm5 logically shift left by 2) gr[reg in list12] load-memory(sp,word) sp sp+4 repeat 2 steps above until all regs in list12 is loaded pc gr[reg1] n+3 note 4 n+3 note 4 n+3 note 4 div reg1,reg2,reg3 rrrrr111111rrrrr wwwww01011000000 gr[reg2] gr[reg2]gr[reg1] gr[reg3] gr[reg2]%gr[reg1] 35 35 35 reg1,reg2 rrrrr000010rrrrr gr[reg2] gr[reg2]gr[reg1] note 6 35 35 35 divh reg1,reg2,reg3 rrrrr111111rrrrr wwwww01010000000 gr[reg2] gr[reg2]gr[reg1] note 6 gr[reg3] gr[reg2]%gr[reg1] 35 35 35 divhu reg1,reg2,reg3 rrrrr111111rrrrr wwwww01010000010 gr[reg2] gr[reg2]gr[reg1] note 6 gr[reg3] gr[reg2]%gr[reg1] 34 34 34 divu reg1,reg2,reg3 rrrrr111111rrrrr wwwww01011000010 gr[reg2] gr[reg2]gr[reg1] gr[reg3] gr[reg2]%gr[reg1] 34 34 34 ei 1000011111100000 0000000101100000 psw.id 0111 halt 0000011111100000 0000000100100000 stop 1 1 1 hsw reg2,reg3 rrrrr11111100000 wwwww01101000100 gr[reg3] gr[reg2](15 : 0) ll gr[reg2] (31 : 16) 1 1 1 0 jarl disp22,reg2 rrrrr11110dddddd ddddddddddddddd0 note 7 gr[reg2] pc+4 pc pc+sign-extend(disp22) 333 jmp [reg1] 00000000011rrrrr pc gr[reg1] 4 4 4 jr disp22 0000011110dddddd ddddddddddddddd0 note 7 pc pc+sign-extend(disp22) 3 3 3 ld.b disp16[reg1],reg2 rrrrr111000rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) gr[reg2] sign-extend(load-memory(adr,byte)) 11 note 11 ld.bu disp16[reg1],reg2 rrrrr11110brrrrr dddddddddddddd1 notes 8, 10 adr gr[reg1]+sign-extend(disp16) gr[reg2] zero-extend(load-memory(adr,byte)) 11 note 11
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 948 (3/6) execution clock flags mnemonic operand opcode operation irlcyovszsat ld.h disp16[reg1],reg2 rrrrr111001rrrrr ddddddddddddddd0 note 8 adr gr[reg1]+sign-extend(disp16) gr[reg2] sign-extend(load-memory(adr,halfword)) 11 note 11 other than regid = psw 1 1 1 ldsr reg2,regid rrrrr111111rrrrr 0000000000100000 note 12 sr[regid] gr[reg2] regid = psw 1 1 1 ld.hu disp16[reg1],reg2 rrrrr111111rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-exend(disp16) gr[reg2] zero-extend(load-memory(adr,halfword) 11 note 11 ld.w disp16[reg1],reg2 rrrrr111001rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-exend(disp16) gr[reg2] load-memory(adr,word) 11 note 11 reg1,reg2 rrrrr000000rrrrr gr[reg2] gr[reg1] 1 1 1 imm5,reg2 rrrrr010000iiiii gr[reg2] sign-extend(imm5) 1 1 1 mov imm32,reg1 00000110001rrrrr iiiiiiiiiiiiiiii iiiiiiiiiiiiiiii gr[reg1] imm32 2 2 2 movea imm16,reg1,reg2 rrrrr110001rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+sign-extend(imm16) 1 1 1 movhi imm16,reg1,reg2 rrrrr110010rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+(imm16 ll 0 16 )111 reg1,reg2,reg3 rrrrr111111rrrrr wwwww01000100000 gr[reg3] ll gr[reg2] gr[reg2]xgr[reg1] 1 2 note 14 2 mul note 22 imm9,reg2,reg3 rrrrr111111iiiii wwwww01001iiii00 note 13 gr[reg3] ll gr[reg2] gr[reg2]xsign-extend(imm9) 1 2 note 14 2 reg1,reg2 rrrrr000111rrrrr gr[reg2] gr[reg2] note 6 xgr[reg1] note 6 112 mulh imm5,reg2 rrrrr010111iiiii gr[reg2] gr[reg2] note 6 xsign-extend(imm5) 1 1 2 mulhi imm16,reg1,reg2 rrrrr110111rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1] note 6 ximm16 1 1 2 reg1,reg2,reg3 rrrrr111111rrrrr wwwww01000100010 gr[reg3] ll gr[reg2] gr[reg2]xgr[reg1] 1 2 note 14 2 mulu note 22 imm9,reg2,reg3 rrrrr111111iiiii wwwww01001iiii10 note 13 gr[reg3] ll gr[reg2] gr[reg2]xzero-extend(imm9) 1 2 note 14 2 nop 000 00 000 00 00 00 00 pass at least one clock cycle doing nothing. 1 1 1 not reg1,reg2 rrrrr000001rrrrr gr[reg2] not(gr[reg1]) 1 1 1 0 bit#3,disp16[reg1] 01bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not(load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,z flag) 3 note 3 3 note 3 3 note 3 not1 reg2,[reg1] rrrrr111111rrrrr 0000000011100010 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,z flag) 3 note 3 3 note 3 3 note 3
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 949 (4/6) execution clock flags mnemonic operand opcode operation irlcyovszsat or reg1,reg2 rrrrr001000rrrrr gr[reg2] gr[reg2]or gr[reg1] 1 1 1 0 ori imm16,reg1,reg2 rrrrr110100rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]or zero-extend(imm16) 1 1 1 0 list12,imm5 0000011110iiiiil lllllllllll00001 store-memory(sp?4,gr[reg in list12],word) sp sp?4 repeat 1 step above until all regs in list12 is stored sp sp-zero-extend(imm5) n+1 note 4 n+1 note 4 n+1 note 4 prepare list12,imm5, sp/imm note 15 0000011110iiiiil lllllllllllff011 imm16/imm32 note 16 store-memory(sp?4,gr[reg in list12],word) gr[reg in list 12] load-memory(sp,word) sp sp+4 repeat 2 step above until all regs in list12 is loaded pc gr[reg1] n+2 note 4 note 17 n+2 note 4 note 17 n+2 note 4 note 17 reti 0000011111100000 0000000101000000 if psw.ep=1 then pc eipc psw eipsw else if psw.np=1 then pc fepc psw fepsw else pc eipc psw eipsw 444 rrrrr reg1,reg2 rrrrr111111rrrrr 0000000010100000 gr[reg2] gr[reg2]arithmetically shift right by gr[reg1] 111 0 sar imm5,reg2 rrrrr010101iiiii gr[reg2] gr[reg2]arithmetically shift right by zero-extend (imm5) 111 0 sasf cccc,reg2 rrrrr1111110cccc 0000001000000000 if conditions are satisfied then gr[reg2] (gr[reg2]logically shift left by 1) or 00000001h else gr[reg2] (gr[reg2]logically shift left by 1) or 00000000h 111 reg1,reg2 rrrrr000110rrrrr gr[reg2] saturated(gr[reg2]+gr[reg1]) 1 1 1 satadd imm5,reg2 rrrrr010001iiiii gr[reg2] saturated(gr[reg2]+sign-extend(imm5) 1 1 1 satsub reg1,reg2 rrrrr000101rrrrr gr[reg2] saturated(gr[reg2]?gr[reg1]) 1 1 1 satsubi imm16,reg1,reg2 rrrrr110011rrrrr iiiiiiiiiiiiiiii gr[reg2] saturated(gr[reg1]?sign-extend(imm16) 1 1 1 satsubr reg1,reg2 rrrrr000100rrrrr gr[reg2] saturated(gr[reg1]?gr[reg2]) 1 1 1 setf cccc,reg2 rrrrr1111110cccc 0000000000000000 if conditions are satisfied then gr[reg2] 00000001h else gr[reg2] 00000000h 111
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 950 (5/6) execution clock flags mnemonic operand opcode operation irlcyovszsat bit#3,disp16[reg1] 00bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not (load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,1) 3 note 3 3 note 3 3 note 3 set1 reg2,[reg1] rrrrr111111rrrrr 0000000011100000 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,1) 3 note 3 3 note 3 3 note 3 reg1,reg2 rrrrr111111rrrrr 0000000011000000 gr[reg2] gr[reg2] logically shift left by gr[reg1] 1 1 1 0 shl imm5,reg2 rrrrr010110iiiii gr[reg2] gr[reg2] logically shift left by zero-extend(imm5) 111 0 reg1,reg2 rrrrr111111rrrrr 0000000010000000 gr[reg2] gr[reg2] logically shift right by gr[reg1] 1 1 1 0 shr imm5,reg2 rrrrr010100iiiii gr[reg2] gr[reg2] logically shift right by zero-extend(imm5) 111 0 sld.b disp7[ep],reg2 rrrrr0110ddddddd adr ep+zero-extend(disp7) gr[reg2] sign-extend(load-memory(adr,byte)) 11 note 9 sld.bu disp4[ep],reg2 rrrrr0000110dddd note 18 adr ep+zero-extend(disp4) gr[reg2] zero-extend(load-memory(adr,byte)) 11 note 9 sld.h disp8[ep],reg2 rrrrr1000ddddddd note 19 adr ep+zero-extend(disp8) gr[reg2] sign-extend(load-memory(adr,halfword)) 11 note 9 sld.hu disp5[ep],reg2 rrrrr0000111dddd notes 18, 20 adr ep+zero-extend(disp5) gr[reg2] zero-extend(load-memory(adr,halfword)) 11 note 9 sld.w disp8[ep],reg2 rrrrr1010dddddd0 note 21 adr ep+zero-extend(disp8) gr[reg2] load-memory(adr,word) 11 note 9 sst.b reg2,disp7[ep] rrrrr0111ddddddd adr ep+zero-extend(disp7) store-memory(adr,gr[reg2],byte) 111 sst.h reg2,disp8[ep] rrrrr1001ddddddd note 19 adr ep+zero-extend(disp8) store-memory(adr,gr[reg2],halfword) 111 sst.w reg2,disp8[ep] rrrrr1010dddddd1 note 21 adr ep+zero-extend(disp8) store-memory(adr,gr[reg2],word) 111 st.b reg2,disp16[reg1] rrrrr111010rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) store-memory(adr,gr[reg2],byte) 111 st.h reg2,disp16[reg1] rrrrr111011rrrrr ddddddddddddddd0 note 8 adr gr[reg1]+sign-extend(disp16) store-memory (adr,gr[reg2], halfword) 111 st.w reg2,disp16[reg1] rrrrr111011rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-extend(disp16) store-memory (adr,gr[reg2], word) 111 stsr regid,reg2 rrrrr111111rrrrr 0000000001000000 gr[reg2] sr[regid] 1 1 1
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 951 (6/6) execution clock flags mnemonic operand opcode operation irlcyovszsat sub reg1,reg2 rrrrr001101rrrrr gr[reg2] gr[reg2]?gr[reg1] 1 1 1 subr reg1,reg2 rrrrr001100rrrrr gr[reg2] gr[reg1]?gr[reg2] 1 1 1 switch reg1 00000000010rrrrr adr (pc+2) + (gr [reg1] logically shift left by 1) pc (pc+2) + (sign-extend (load-memory (adr,halfword)) logically shift left by 1 555 sxb reg1 00000000101rrrrr gr[reg1] sign-extend (gr[reg1] (7 : 0)) 111 sxh reg1 00000000111rrrrr gr[reg1] sign-extend (gr[reg1] (15 : 0)) 111 trap vector 00000111111iiiii 0000000100000000 eipc pc+4 (return pc) eipsw psw ecr.eicc exception code (40h to 4fh, 50h to 5fh) psw.ep 1 psw.id 1 pc 00000040h (when vector is 00h to 0fh (exception code: 40h to 4fh)) 00000050h (when vector is 10h to 1fh (exception code: 50h to 5fh)) 444 tst reg1,reg2 rrrrr001011rrrrr result gr[reg2] and gr[reg1] 1 1 1 0 bit#3,disp16[reg1] 11bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not (load-memory-bit (adr,bit#3)) 3 note 3 3 note 3 3 note 3 tst1 reg2, [reg1] rrrrr111111rrrrr 0000000011100110 adr gr[reg1] z flag not (load-memory-bit (adr,reg2)) 3 note 3 3 note 3 3 note 3 xor reg1,reg2 rrrrr001001rrrrr gr[reg2] gr[reg2] xor gr[reg1] 1 1 1 0 xori imm16,reg1,reg2 rrrrr110101rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1] xor zero-extend (imm16) 1 1 1 0 zxb reg1 00000000100rrrrr gr[reg1] zero-extend (gr[reg1] (7 : 0)) 1 1 1 zxh reg1 00000000110rrrrr gr[reg1] zero-extend (gr[reg1] (15 : 0)) 1 1 1 notes 1. dddddddd: higher 8 bits of disp9. 2. 4 if there is an instruction that rewrites the contents of the psw immediately before. 3. if there is no wait state (3 + the number of read access wait states). 4. n is the total number of list12 load registers. (according to the number of wait states. also, if there are no wait states, n is the total number of list12 registers. if n = 0, same operation as when n = 1) 5. rrrrr: other than 00000. 6. the lower halfword data only are valid. 7. ddddddddddddddddddddd: the higher 21 bits of disp22. 8. ddddddddddddddd: the higher 15 bits of disp16. 9. according to the number of wait states (1 if there are no wait states). 10. b: bit 0 of disp16. 11. according to the number of wait states (2 if there are no wait states).
appendix b inst ruction set list preliminary user?s manual u16031ej2v1ud 952 notes 12. in this instruction, for convenience of mnemonic description, the source register is made reg2, but the reg1 field is used in the opcode. therefore, the meaning of register specification in the mnemonic description and in the opcode differs from other instructions. r r r r r = regid specification rrrrr = reg2 specification 13. i i i i i : lower 5 bits of imm9. i i i i : higher 4 bits of imm9. 14. in the case of reg2 = reg3 (the lower 32 bits of the results are not written in the register) or reg3 = r0 (the higher 32 bits of the results are not written in the register), shortened by 1 clock. 15. sp/imm: specified by bits 19 and 20 of the sub-opcode. 16. ff = 00: load sp in ep. 01: load sign expanded 16-bit immediate data (bits 47 to 32) in ep. 10: load 16-bit logically left shifted 16-bit immediate data (bits 47 to 32) in ep. 11: load 32-bit immediate data (bits 63 to 32) in ep. 17. if imm = imm32, n + 3 clocks. 18. r r r r r : other than 00000. 19. ddddddd: higher 7 bits of disp8. 20. dddd: higher 4 bits of disp5. 21. dddddd: higher 6 bits of disp8. 22. do not make a combination that satisfies all the following conditions when using the ?mul reg1, reg2, reg3? instruction and ?mulu reg1, reg2, reg3? instruction. operation is not guaranteed when an instruction that satisfies the following conditions is executed. ? reg1 = reg3 ? reg1 reg2 ? reg1 r0 ? reg3 r0
953 preliminar y user?s manual u16031ej2v1ud appendix c revision history the following table shows the revision history up to this edition. the ?applied to:? column indicates the chapters of each edition in which the revision was applied. (1/5) edition major revision from previous edition applied to: ? addition of the following product. pd703111gm-15-ueu ? change of the following register name. pfcal pfcall throughout addition of execution time of 150 mhz products to minimum instruction execution time in 1.2 features chapter 1 introduction addition of note in 2.1 (2) non-port pins addition of description in 2.3 (1) (b) (vii) uclk (usb clock) modification of description in 2.3 (3) (b) (ii) dmaak0, dmaak1 (dma acknowledge) modification of description in 2.3 (5) (b) (ii) dmaak2, dmaak3 (dma acknowledge) chapter 2 pin functions addition of execution time of 150 mhz products to minimum instruction execution time in 3.1 features modification of default value in 3.2.1 (2) program counter (pc) modification of description in 3.4.7 peripheral i/o registers change of table of vswc setting values in 3.4.9 system wait control register (vswc) chapter 3 cpu function modification of description in 4.2.1 pin status during internal instruction ram, internal data ram, and peripheral i/o access modification of description when btn1 and btn0 bits are set to 11 in 4.4.1 (1) bus cycle type configuration registers 0, 1 (bct0, bct1) modification of table of number of access clocks in 4.5.1 number of access clocks addition to cautions and modification of description in 4.5.6 (1) line buffer control registers 0, 1 (lbc0, lbc1) addition of remark in 4.5.6 (1) (a) speculative read function (read buffer function) modification of description, addition of note, and addition to cautions in 4.5.6 (1) (b) write buffer function addition to cautions in 4.7.1 (3) bus cycle period control register (bcp) modification of cautions in 4.9.1 (1) cache configuration register (bhc) addition of (5) in 4.10.3 cautions addition of timing and modification of notes in 4.11.6 (1) sdram (when read, latency = 2, no idle state insertion) addition of timing and modification of notes in 4.11.6 (2) sdram (when read, latency = 2, two idle states inserted, 32-bit bus width) addition of timing and modification of notes in 4.11.6 (3) sdram (when written) addition of 4.14 timing at which t0 state is not inserted chapter 4 bus control function addition of timing and modification of notes in figure 5-9 sdram single read cycle 2nd addition of timing and modification of notes in figure 5-10 sdram single write cycle chapter 5 memory access control function
appendix c revision history 9 54 preliminar y user?s manual u16031ej2v1ud (2/5) edition major revision from previous edition applied to: addition of timing and modification of notes in figure 5-11 sdram access timing modification of caution in 5.3.6 (1) sdram refresh control registers 1, 3, 4, 6 (rfs1, rfs3, rfs4, rfs6) modification of description in table 5-1 example of interval factor settings chapter 5 memory access control function addition of internal instruction ram in block diagram in 6.2 configuration addition to cautions in 6.3.1 (1) dma source address registers 0h to 3h (dsa0h to dsa3h) addition to cautions in 6.3.2 (1) dma destination address registers 0h to 3h (dda0h to dda3h) addition to cautions in 6.3.3 dma transfer count registers 0 to 3 (dbc0 to dbc3) addition to cautions in 6.3.4 dma addressing control registers 0 to 3 (dadc0 to dadc3) addition to cautions and description in 6.3.5 dma channel control registers 0 to 3 (dchc0 to dchc3) addition to cautions and description in 6.3.6 dma terminal count output control register (dtoc) addition to cautions in 6.3.7 dma trigger factor registers 0 to 3 (dtfr0 to dtfr3) addition of 6.3.7 (1) dma request detection function addition of caution and note and modification of description in 6.3.8 dma interface control register (difc) addition of timing and modification of notes in figure 6-12 timing of 2-cycle dma transfer (sdram sram) addition of 6.5.1 (1) timing of dmarqn and dmaakn signals for 2-cycle transfer addition of 6.5.1 (2) dmaakn signal active width extension function addition of 6.5.1 (3) outline of 2-cycle transfer timing modification of timing in figure 6-19 timing of dma flyby transfer (external i/o sdram) modification of timing in figure 6-23 timing of dma flyby transfer (sdram external i/o) modification of timing in figure 6-24 timing of dma flyby transfer (external i/o sdram) modification of description and addition to caution in table 6-5 relationship between transfer type and transfer object addition of description in 6.8 next address setting function addition of cautions in 6.9 dma transfer start factors modification of description in 6.13 times related to dma transfer modification of description in 6.15 (3) bus arbitration for cpu addition of 6.15 (7) read values of dsan and ddan registers chapter 6 dma functions (dma controller) 2nd modification of note in figure 7-14 pipeline operation at interrupt request acknowledgment (outline) chapter 7 interrupt/exception processing function
appendix c revision history 955 preliminar y user?s manual u16031ej2v1ud (3/5) edition major revision from previous edition applied to: modification of selection of sscg output by pllsel pin and mdl-selector table (modulation period) in 8.1 features addition to cautions and modification of description in 8.3.1 clock control register (ckc) modification of sample coding <2> for data setting sequence of clock source select register (cks) in 8.3.2 clock source select register (cks) modification of description in 8.3.3 sscg control register (sscgc) addition of caution in 8.3.4 usb clock control register (uckc) modification of oscillation stabilization time in 8.3.6 oscillation stabilization time select register (osts) addition to notes in table 8-1 operation status of each clock modification of description in table 8-2 frequency list addition of 8.5 operating clock provisions modification of oscillation stabilization time in table 8-11 counting time examples chapter 8 clock generation function addition to caution in 9.1.5 (2) timer mode control registers c01 to c51 (tmcc01 to tmcc51) modification of figure 9-7 tmc1 compare operation example (set/reset output mode) addition of noise elimination width when f x = 150 mhz in table 9-6 relationship between ncw1n register set value and noise elimination width addition of 9.3.7 (6) overflow interrupt signal (intov1n) and underflow interrupt signal (intud1n) chapter 9 timer/ counter function (real-time pulse unit) modification of transfer rate in 10.2.1 features modification of description in 10.2.2 (10) uartbn receive data register ap (ubnrxap), uartbn receive data register (ubnrx) (n = 0, 1) addition of description in 10.2.2 (12) uartbn transmit data register n (ubntx) (n = 0, 1) modification of caution in 10.2.3 (3) uartbn control register 2 (ubnctl2) (n = 0, 1) addition of description in 10.2.3 (4) uartbn transmit data register (ubntx) (n = 0, 1) modification of description in 10.2.3 (5) uartbn receive data register ap (ubnrxap), uartbn receive data register (ubnrx) (n = 0, 1) addition and modification of description in 10.2.3 (6) uartbn fifo control register 0 (ubnfic0) (n = 0, 1) modification of description in 10.2.3 (7) uartbn fifo control register 1 (ubnfic1) (n = 0, 1) addition of description in 10.2.4 (5) (b) fifo mode addition of description in 10.2.5 (2) pending mode/pointer mode addition of note in 10.2.5 (2) (a) (i) during transmission (writing to transmit fifon) addition of note in 10.2.5 (2) (a) (ii) during reception (reading from receive fifon) chapter 10 serial interface function addition of description in 10.2.6 (4) (c) (ii) reception timeout interrupt (ubtiton) (in fifo mode only) 2nd addition of value when f x = 150 mhz in table 10-4 baud rate generator setting data chapter 10 serial interface function
appendix c revision history 9 56 preliminar y user?s manual u16031ej2v1ud (4/5) edition major revision from previous edition applied to: addition of 10.2.8 control flow modification of description in figure 10-22 block diagram of clocked serial interfaces 30 and 31 modification of description of caution 2 in 10.3.3 (1) clocked serial interface mode registers 30, 31 (csim30, csim31) modification of description in 10.3.3 (2) clocked serial interface clock select registers 30, 31 (csic30, csic31) addition of description in 10.3.3 (3) receive data buffer registers 30, 31 (sirb30, sirb31) addition of description in 10.3.3 (4) transmit data csi buffer registers 30, 31 (sfdb30, sfdb31) modification of description in 10.3.3 (5) csibuf status registers 30, 31 (sfa30, sfa31) modification of example in caution 2 in 10.3.4 (2) baud rate modification of description in figure 10-25 transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: msb first (dirn bit = 0 in csim3n register) modification of description in figure 10-26 transfer data length: 8 bits (ccln3 to ccln0 bits = 1000 in csil3n register), transfer direction: lsb first (dirn bit = 1 in csim3n register) deletion of description of 10.3.5 (7) slave mode modification of figure 10-30 slave mode (ckpn and dapn bits = 00 in csic3n register, ccln3 to ccln0 bits = 1000 in csil3n register (transfer data length: 8 bits)) modification of description in figure 10-32 continuous mode modification of description in 10.3.5 (11) transmission mode addition of description in 10.3.5 (12) reception mode deletion of description in 10.3.5 (16) (a) sckn pin modification of description in table 10-8 default output level of sckn pin modification of description of (1) to (12) in 10.3.6 usage chapter 10 serial interface function addition of caution in 11.1 overview addition of items in table 11-2 correspondence between requests and decoded values addition of description in 11.4.1 (3) uf0 epnak register (uf0en) deletion of description in 11.4.1 (9) uf0 ep status 1 register (uf0eps1) modification of description in 11.4.1 (11) uf0 int status 0 register (uf0is0) modification of description in 11.4.1 (34) uf0 mode status register (uf0mods) modification of description in 11.4.3 (2) uf0 ep0 status register l (uf0e0sl) modification of description in 11.4.3 (9) uf0 address register (uf0adrs) modification of description in 11.4.3 (10) uf0 configuration register (uf0cnf) modification of description in 11.4.3 (11) uf0 interface 0 register (uf0if0) 2nd modification of description in 11.4.3 (12) uf0 interface 1 to 4 registers (uf0if1 to uf0if4) chapter 11 usb function controller (usbf)
appendix c revision history 957 preliminar y user?s manual u16031ej2v1ud (5/5) edition major revision from previous edition applied to: modification of caution 2 in 11.4.3 (14) uf0 device descriptor registers 0 to 17 (uf0dd0 to uf0dd17) modification of caution 2 in 11.4.3 (15) uf0 configuration/interface/endpoint descriptor registers 0 to 255 (uf0cie0 to uf0cie255) modification of caution in 11.4.4 (1) usb function 0 dma channel select register (uf0cs) deletion of caution in table 11-8 fw-supported standard requests modification of description in figure 11-15 automatically processed requests for control transfer modification of description in figure 11-20 cpudec request for control transfer modification of description in figure 11-30 usb connection example chapter 11 usb function controller (usbf) addition of value when f x = 150 mhz in table 12-1 setting of a/d conversion operation time addition of 12.9 how to read a/d converter characteristics table chapter 12 a/d converter modification of repeat frequency in 13.1 features modification of description in figure 13-1 block diagram of pwm unit modification of description in 13.3 (1) pwm control registers 0 and 1 (pwmc0 and pwmc1) modification of description in 13.4.2 (1) setting for starting pwm operation modification of description in table 13-1 repeat cycle of pwmn chapter 13 pwm unit modification of caution in 14.3.8 port dh modification of caution and description on bit 0 in 14.3.8 (2) (c) port dh function control register (pfcdh) addition to caution in 14.3.10 (2) (c) port ct function control register (pfcct) addition of noise elimination width when f x = 150 mhz in table 14-4 relationship between ncw1n register set value and noise elimination width chapter 14 port functions modification of value of program counter (pc) after reset in table 15-2 initial value of cpu, internal data ram, internal instruction ram, and on-chip peripheral i/o after reset chapter 15 reset functions modification of description in 16.1.1 (7) mask function chapter 16 debug function (dcu) addition of chapter 17 electrical specifications (target values) chapter 17 electrical specifications addition of chapter 18 package drawing chapter 18 package drawing addition of chapter 19 recommended soldering conditions chapter 19 recommended soldering conditions addition to note in b.2 instruction set (in alphabetical order) appendix b instruction set list 2nd addition of appendix c revision history appendix c revision history


▲Up To Search▲   

 
Price & Availability of UPD703111

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X